Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Entity relationships and data inconsistency

You could also define a @Basic mapping for the foreign key so you can detect
it.

But better to fix your corrupt data, or not have corrupt data to begin with. 
If you define a foreign key constraint on the foreign key, then you can
avoid having the corrupt data.


Patric Rufflar wrote:
> 
> Hello all,
> 
> imagine an entity A which has a ManyToOne relationship to an entity B.
> Consider a record of A which contains an invalid foreign id of B.
> 
> When find()-ing A, the reference to B is set to null, even the 
> underlying column contains an id.
> With the consequence that an application cannot distinguish between a 
> true null foreign key and a data inconsistency situation.
> 
> Is there any way to detect these with eclipselink? Am I missing 
> something?
> 
> Thanks.
> 
> - Patric
> 
> 


-----
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.eclipse.org/forums/index.php?t=thread&frm_id=111&S=1b00bfd151289b297688823a00683aca
EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/Entity-relationships-and-data-inconsistency-tp34071268p34086645.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top