Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » OneToOne Mapping Exception
OneToOne Mapping Exception [message #1265845] Thu, 06 March 2014 16:28 Go to next message
Subhadip Chatterjee is currently offline Subhadip Chatterjee
Messages: 12
Registered: December 2013
Junior Member
Hello,
I am using a Workbench project and getting one deployment-xml exported, to use in a Web-Application.

The below error is a recurring one, which is blocking the functional testing.
To set the context, it is a non-JPA project and a migration attempt from TopLink 9.0.4

For this particular issues, two tables are involved:
Vista_Rule and Vista_Rule_Applicability
The first table refers to the second one, with a One-to-One relational mapping.

The Data-mapping objects are Rule.java [for Vista_Rule] & Applicability.java [Vista_Rule_Applicability]. These are again non-JPA types. A custom framework (quite a old one), maps the resp. results with these objects.

When I mapped the descriptors of these tables, using the WorkBench, I found that Rule has an attribute & one-to-one mapping for Applicability.
Again, Applicability, has an attribute & one-to-one mapping for Rule. So, when a sql query is executed, to fetch a Rule-record, the below exception occurs.
Ideally, it should bear with a NoContainerPolicy whereas due to unknown reason it is receiving ContainerIndirectionPolicy [as if it is a one-to-many]

====
Exception Description: The operation [buildContainer constructor (null) Failed: java.lang.NullPointerException] is invalid for this indirection policy [org.eclipse.persistence.internal.indirection.ContainerIndirectionPolicy@ebc1f0ed].

Mapping: org.eclipse.persistence.mappings.OneToOneMapping[applicabilityHolder]
Descriptor: RelationalDescriptor(com.vista.business.ruleengine.rules.Rule --> [DatabaseTable(VISTA_RULE)])
====

Please suggest. It is quite urgent for the testing of this project.
Re: OneToOne Mapping Exception [message #1266027 is a reply to message #1265845] Thu, 06 March 2014 22:19 Go to previous messageGo to next message
Subhadip Chatterjee is currently offline Subhadip Chatterjee
Messages: 12
Registered: December 2013
Junior Member
Some more details from the exception stack trace,

Exception [EclipseLink-152] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The operation [buildContainer constructor (null) Failed: java.lang.NullPointerException] is invalid for this indirection policy [org.eclipse.persistence.internal.indirection.ContainerIndirectionPolicy@e8a931d1].
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[applicabilityHolder]
Descriptor: RelationalDescriptor(com.vista.business.ruleengine.rules.Rule --> [DatabaseTable(VISTA_RULE)])
at org.eclipse.persistence.exceptions.DescriptorException.invalidIndirectionPolicyOperation(DescriptorException.java:854)
at org.eclipse.persistence.internal.indirection.ContainerIndirectionPolicy.buildContainer(ContainerIndirectionPolicy.java:90)
at org.eclipse.persistence.internal.indirection.ContainerIndirectionPolicy.valueFromBatchQuery(ContainerIndirectionPolicy.java:372)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.batchedValueFromRow(ForeignReferenceMapping.java:215)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow(ForeignReferenceMapping.java:1982)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.readFromRowIntoObject(ForeignReferenceMapping.java:1353)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:445)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:798)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:603)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:1081)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:436)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1081)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1040)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:392)
at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2831)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
Re: OneToOne Mapping Exception [message #1269176 is a reply to message #1266027] Tue, 11 March 2014 13:36 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1034
Registered: July 2009
Senior Member
If this is still an issue, please provide the mapping from the project.xml that is generated. It might be better to file a support case for this type of issue as they can be difficult to track down in a timely fashion.

[Updated on: Tue, 11 March 2014 13:37]

Report message to a moderator

Re: OneToOne Mapping Exception [message #1386756 is a reply to message #1269176] Fri, 20 June 2014 07:02 Go to previous messageGo to next message
Subhadip Chatterjee is currently offline Subhadip Chatterjee
Messages: 12
Registered: December 2013
Junior Member
Thanks Chris. The issue is resolved after I programmatically invoked containerIndirectionPolicy.initialize(), for the DatabaseMapping.
Re: OneToOne Mapping Exception [message #1386813 is a reply to message #1386756] Fri, 20 June 2014 17:51 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1034
Registered: July 2009
Senior Member
I'm surprised that is needed since it should be initialized when the mapping is initialized, which again occurs when the descriptor is initialized. How is the session being created and when are the mappings being added to the project?
Previous Topic:eclipselink stackoverflow exceptions - repeating same query thousand of time
Next Topic:EclipseLink 2.3: One-to-one association
Goto Forum:
  


Current Time: Thu Oct 23 16:06:12 GMT 2014

Powered by FUDForum. Page generated in 0.01836 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software