|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Cascading entitiesHello 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@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: Cascading entitiesPlease 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).
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
|
|
Re: Cascading entitiesJames Sutherland skrev:
> 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). Thank you so much for the pointers, I figured it out eventually. :-) (Sorry for the late response, but thought that I had sent this mail before I went on a weekend holiday, but I guess not). -- Regards Christian Michelsen _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
| Free embeddable forum powered by Nabble | Forum Help |