Results 1 to 3 of 3
  1. #1
    The_S is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Default JPA Composite Primary Key

    Hi,

    I'm new and this is my first post. Sorry for my bad english, it isn't my first language :o .

    I have a table 'A', 'B' and 'C'. And i want to have a table 'A_B_C_ASSIGNMENT', which contains the id from 'A', 'B' and 'C' as foreign key. The assignment table will not have an separate identity. The id from 'A' and 'B' will be used as unique primary key.

    How can I build an entity which represents this case with JPA?

    I've got a solution with @EmbeddedId and @Embeddable annotations. But if I say, that the 'A_B_C_ASSIGNMENT' table should be removed when 'A' will be removed (Set with 'A_B_C_ASSIGNMENT' in 'A' is set to 'cascade = CascadeType.ALL'), there will be an jdbc-batch-update exception, because the according dataset in 'A_B_C_ASSIGNMENT' table doesn't become deleted. It works, if i delete the dataset in 'A_B_C_ASSIGNMENT' manually before removing the 'A' dataset.

    Thank You!

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    8

    Default

    I'm sorry I can't help, but I wanted to tell you that I at least looked at your post. I'm not familiar with JPA...

  3. #3
    The_S is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

Similar Threads

  1. How to generate primary key in EJB
    By naresh_m in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-17-2008, 10:41 AM
  2. Replies: 0
    Last Post: 05-14-2008, 10:46 AM
  3. Replies: 0
    Last Post: 05-14-2008, 08:18 AM
  4. Replies: 1
    Last Post: 05-01-2008, 04:19 PM
  5. how to determine the primary key
    By osval in forum JDBC
    Replies: 1
    Last Post: 08-07-2007, 03:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •