| Author |
Can a class be mapped to a table and be Embeddable at the same time?
|
Timothy Sam
Ranch Hand
Joined: Sep 18, 2005
Posts: 745
|
|
I have this class called InventoryTransaction... I'm doing this in JPA Now, I need userId to be changed from an Integer to a InventoryUser object which is already existing and is mapped to a table. I want my InventoryUser class to be embeddable and at the same time be mapped to a table. Is this possible? Thanks! [ June 28, 2007: Message edited by: Timothy Sam ]
|
SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://game-rumble.com/ - http://everypesocounts.com/
|
 |
Mike Keith
author
Ranch Hand
Joined: Jul 14, 2005
Posts: 304
|
|
It looks like InventoryUser is a separate entity and should be mapped as a one-to-one to your InventoryTransaction entity. It has a PK, named queries and everything, so it isn't an embedded entity at all. I guess I'm not clear on why you want to make it one... An embedded entity is one that by definition does not have its own identity but depends upon that of its owning entity, and must therefore also be stored in the table of its owning entity.
|
-Mike
Pro JPA 2: Mastering the Java Persistence API
|
 |
Timothy Sam
Ranch Hand
Joined: Sep 18, 2005
Posts: 745
|
|
Hi! In my design, the following should defined as an inventory transaction has many to one user a user has one to many transactions a user has a one to many inventory item an inventory item has many to 1 user I just don't know how to incorporate this with my JPA mapping... Have I supplied enough information? Thanks!
|
 |
Timothy Sam
Ranch Hand
Joined: Sep 18, 2005
Posts: 745
|
|
Uhmmm... Can I get a help with this?
Caused by: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.ValidationException Exception Description: An incompatible mapping has been encountered between [class com.wp.wpinventory.model.FixedItem] and [class com.wp.wpinventory.model.InventoryTransaction]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer.
Here's what I've been doing... in FixedItem.java The mappings were originally generated by netbeans for me. But now that I'm doing everything manually I'm really having problems especially with joins. Thanks! [ July 03, 2007: Message edited by: Timothy Sam ]
|
 |
 |
|
|
subject: Can a class be mapped to a table and be Embeddable at the same time?
|
|
|