« Return to Thread: Cascading entities

Re: Cascading entities

by James Sutherland :: Rate this Message:

Reply to Author | View in Thread

Please include the mappings/annotations that you currently have.
Because the description has a composite primary key, you will need to define a PrimaryKeyClass.

Refer to,
http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing#Composite_Primary_Keys

and,
http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing#Primary_Keys_through_OneToOne_Relationships

Using a primary key from a ManyToOne can be a little complex in JPA 1.0, but it is simpler in JPA 2.0 as you can put @Id on a ManyToOne (EclipseLink 2.0).


Chr|stian wrote:
Hello there smart and beautiful people :-)
I'm somewhat embarrassed to ask this question, but come to the
conclusion that banging ones head into the wall is a useless pastime.

I'm having some difficulty updating one of my entities that is inside
yet another entity. I have several types of these, but here's an example:

I have two tables, categories and categories_description, the latter
holds i18n-versions of the category name, it's description etc.

Now the categories_description has a composite key based on an
categoryID and a languageID, now I can read from the database with no
real problem, however when it comes to updating the buggers I'm at a
loss. The categoryID is ofcourse the primary key of the categories-table.

So basicly I'm wondering what kind of steps do I need to take to be able
to update a category and it's descriptions? I've already tried to use
the Cascading-type ALL.

Is it required to create a PrimaryKeyClass to control this?


(and I can't change the structure of the database as it's defined by an
open source project ;)

--
Regards
Christian Michelsen
_______________________________________________
eclipselink-users mailing list
eclipselink-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

 « Return to Thread: Cascading entities