Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Cascading entities

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@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Cascading-entities-tp24260292p24275319.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top