Re: How to persist a property of type List<String>in JPA

Discussion in 'Java' started by Lew, Nov 13, 2008.

  1. Lew

    Lew Guest

    On Nov 13, 10:40 am, Andrea Francia
    <_FROM_HERE_ohohohioquestoèdatogliereohohoho_TO_HERE.it>
    wrote:
    > What is the smartest way to get an entity with a field of type
    > List<String> get persisted?


    @OneToMany

    In a normalized database, the List will correspond to a set of rows
    from a related table.

    It's a little unusual to have a table with only a single String
    column, though. Usually there's a somewhat more complex structure.
    What is the corresponding table structure?

    --
    Lew
    Lew, Nov 13, 2008
    #1
    1. Advertising

  2. Lew

    Lew Guest

    Lew wrote:
    >> It's a little unusual to have a table with only a single String
    >> column, though.  Usually there's a somewhat more complex structure.
    >> What is the corresponding table structure?


    Andrea Francia wrote:
    > I want represents command line arguments of a command.
    > The complete data structure should be something like that:
    >
    > Class data structure:
    > ---------------------
    > public class Command {
    >    private String workindDir; // where start the command
    >    private List<String> commandLineArguments; // command line arguments
    >    ...
    > }
    >
    > Instance example:
    > -----------------
    > workingDir = "/var/log"
    > commandLineArguments = list of {"/bin/ls", "-l", "--color=always"}


    That's not a table structure.

    What's the corresponding table structure?

    JPA is all about object-to-relational mapping (ORM). You haven't told
    us the relational structure.

    --
    Lew
    Lew, Nov 13, 2008
    #2
    1. Advertising

  3. Andrea Francia, Nov 13, 2008
    #3
  4. Lew

    Lew Guest

    On Nov 13, 3:02 pm, Andrea Francia <andrea.fran...@REMOVE-FROM-
    HERE.ohoihihoihoih.TO-HERE.gmx.it> wrote:
    > Lew wrote:
    > > That's not a table structure.

    >
    > Sorry, I realize that I did not understand your question.
    > There is no a pre-existing table structure.
    >
    > My problem is not the mapping a new object model to an existing table
    > structure. I need only persist a given object model.


    So design a table structure.

    --
    Lew
    Lew, Nov 13, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Umut Tezduyar
    Replies:
    0
    Views:
    421
    Umut Tezduyar
    Nov 29, 2005
  2. Umut Tezduyar
    Replies:
    0
    Views:
    417
    Umut Tezduyar
    Dec 2, 2005
  3. redbull
    Replies:
    2
    Views:
    721
    Kenneth P. Turvey
    Oct 31, 2007
  4. Lew
    Replies:
    0
    Views:
    633
  5. john

    jpa persist , merge ?

    john, Dec 24, 2010, in forum: Java
    Replies:
    0
    Views:
    914
Loading...

Share This Page