Hello Rohit,
Not sure what you are after exactly, as you say a6 and b6 are your pks
for T6, but in the file you sent, you show:
t6Builder.setPrimaryKeyFields("a6");
// t6Builder.addDirectMapping("a6", String.class, "a6");
The error is occuring because when you comment the a6 mapping out, the
field no longer has a way to be set. Is there a reason you are
commenting this line out, or why you don't have both a6 and b6 being
defined as primary key fields in the descriptor?
Best Regards,
Chris
On 18/04/2011 10:59 AM, Rohit Banga wrote:
Hi
I have attached a sample program showing three tables - T1, T2, T6.
Ti has columns ai,bi, ... ei. i=1,2,6.
T1 has primary key a1,b1.
T2 has primary key a2,b2.
T6 has primary key a6,b6.
The attached program throws the following exception. Can this be fixed
somehow?
Exception [EclipseLink-46] (Eclipse Persistence Services -
2.2.0.v20110107-r8783):
org.eclipse.persistence.exceptions.DescriptorException
Exception Description: There should be one non-read-only mapping
defined for the primary key field [t6.a6].
Descriptor: RelationalDescriptor(jpatest.t6 --> [DatabaseTable(t6)])
Runtime Exceptions:
---------------------------------------------------------
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:547)
at
org.eclipse.persistence.sessions.Project.addDescriptors(Project.java:295)
at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.addDescriptors(DatabaseSessionImpl.java:226)
at
org.eclipse.persistence.dynamic.DynamicHelper.addTypes(DynamicHelper.java:222)
Thanks in Advance!
On 4/18/2011 7:21 PM, Rohit Banga wrote:
Hi All
To avoid ECLIPSELINK-00046, ECLIPSELINK-00048 (http://wiki.eclipse.org/EclipseLink_Exception_Error_Reference_%28ELUG%29)
with Dynamic JPA, I am planning to use the following strategy.
If a DirectToFieldMapping is defined for a primary key field of a
DynamicType, then for any OneToOneMapping that uses this field set the
OneToOneMapping as read-only.
Can someone please clarify the following:
1. Is the above a reasonable and safe way to avoid the exceptions at
runtime?
2. What is the impact of having a foreign reference mapping as
read-only? Can I not persist changes to the target entity of the
mapping?
--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
|