Home » Eclipse Projects » EclipseLink » EmbeddedObjects - fields not populated correctly(EmbeddedObjects - incorrect use of org.eclipse.persistence.internal.descriptors.PersistenceObjectAtt)
EmbeddedObjects - fields not populated correctly [message #670009] |
Thu, 12 May 2011 12:08 |
TimM Messages: 19 Registered: May 2011 |
Junior Member |
|
|
We have just moved over from toplink to eclipselink, and none of our embedded objects are being correctly populated on calls to em.find() (maybe others to). When debugging I can see that the correctly populated object has been returned from the db (and is in a cache?), but when building / copying/ cloning that object to return to the caller of em.find() it is failing to pull the value out of that object into the returned object. It appears that in here
(org.eclipse.persistence.internal.descriptors.PersistenceObjectAttributeAccessor.getAttributeValueFromObject(Object) ):
public Object getAttributeValueFromObject(Object object) {
return ((PersistenceObject)object)._persistence_get(this.attributeName);
}
the object passed in is the object containing the embedded object, yet this.attributeName is name of the field in the embedded object - in this case 'value' and returns null as there is no attribute named 'value' in the object passed in. I can only see that it would work if the embedded object itself was passed in, or if the attribute name was name of the embedded object.
in the calling method next down the stack frame the direct to field mapping is org.eclipse.persistence.mappings.DirectToFieldMapping[value- - >WSSDBA.WBR_USER.ACHOLLOOKUPONLY].
Something is not quite right with the weaving or something elseewhere, has anyone seen anything similar ?
Eclipselink 2.2.0.
I am trying to reproduce this is a standalone app/ ear but not having much look reproducing in such a scenario.
Thanks
this PersistenceObjectAttributeAccessor PersistenceObjectAttributeAccessor (id=4134) PersistenceObjectAttributeAccessor 4134
attributeField Field Field (id=4156) Field 4156
attributeName String "value" (id=4096) String 4096
isReadOnly boolean false boolean
isWriteOnly boolean false boolean
object Object User (id=3760) User 3760
_persistence_fetchGroup FetchGroup null null
_persistence_inLiquidityGroup_vh WeavedAttributeValueHolderInterface ValueHolder (id=3822) ValueHolder 3822
_persistence_listener PropertyChangeListener null null
_persistence_portfolio_vh WeavedAttributeValueHolderInterface ValueHolder (id=3851) ValueHolder 3851
_persistence_primaryKey Object "WSS" (id=3852) String 3852
_persistence_session Session null null
_persistence_shouldRefreshFetchGroup boolean false boolean
acHolLookupOnly JpaBoolean JpaBoolean (id=3853) JpaBoolean 3853
_persistence_listener PropertyChangeListener null null
value String "0" (id=4172) String 4172
areaUnit String "0058" (id=3854) String 3854
aspClientId int 0 int
bankManager JpaBoolean JpaBoolean (id=3855) JpaBoolean 3855
city String "ZAOPS" (id=3856) String 3856
cityUnit String "0054" (id=3857) String 3857
cmAllowCpwAdjustments JpaBoolean JpaBoolean (id=3858) JpaBoolean 3858
cmAllowOverrideExtBals JpaBoolean JpaBoolean (id=3859) JpaBoolean 3859
cmAllowOverrideWssBals JpaBoolean JpaBoolean (id=3860) JpaBoolean 3860
cmCashAdjusmentsToBeReviewed JpaBoolean JpaBoolean (id=3861) JpaBoolean 3861
cmTargetBalancingToBeReviewed JpaBoolean JpaBoolean (id=3862)
Daemon Thread [p: thread-pool-1; w: 93] (Suspended (breakpoint at line 30 in PersistenceObjectAttributeAccessor))
PersistenceObjectAttributeAccessor.getAttributeValueFromObject(Object) line: 30
DirectToFieldMapping(DatabaseMapping).getAttributeValueFromObject(Object) line: 523
DirectToFieldMapping(AbstractDirectMapping).valueFromRow(AbstractRecord, JoinedAttributeManager, ObjectBuildingQuery, CacheKey, AbstractSession, boolean) line: 1273
DirectToFieldMapping(DatabaseMapping).readFromRowIntoObject(AbstractRecord, JoinedAttributeManager, Object, CacheKey, ObjectBuildingQuery, AbstractSession, boolean) line: 1325
ObjectBuilder.buildAttributesIntoObject(Object, CacheKey, AbstractRecord, ObjectBuildingQuery, JoinedAttributeManager, boolean, AbstractSession) line: 344
AggregateObjectMapping.buildAggregateFromRow(AbstractRecord, Object, CacheKey, JoinedAttributeManager, ObjectBuildingQuery, boolean, AbstractSession, boolean) line: 362
AggregateObjectMapping.readFromRowIntoObject(AbstractRecord, JoinedAttributeManager, Object, CacheKey, ObjectBuildingQuery, AbstractSession, boolean) line: 1415
ObjectBuilder.buildAttributesIntoObject(Object, CacheKey, AbstractRecord, ObjectBuildingQuery, JoinedAttributeManager, boolean, AbstractSession) line: 344
ObjectBuilder.buildProtectedObject(boolean, ObjectBuildingQuery, AbstractRecord, AbstractSession, Object, ClassDescriptor, JoinedAttributeManager) line: 821
ObjectBuilder.buildObject(boolean, ObjectBuildingQuery, AbstractRecord, AbstractSession, Object, ClassDescriptor, JoinedAttributeManager) line: 657
ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuildingQuery, AbstractRecord, UnitOfWorkImpl, Object, ClassDescriptor, JoinedAttributeManager) line: 612
ObjectBuilder.buildObjectInUnitOfWork(ObjectBuildingQuery, JoinedAttributeManager, AbstractRecord, UnitOfWorkImpl, Object, ClassDescriptor) line: 565
ObjectBuilder.buildObject(ObjectBuildingQuery, AbstractRecord, JoinedAttributeManager) line: 497
ObjectBuilder.buildObject(ObjectLevelReadQuery, AbstractRecord) line: 456
ReadObjectQuery(ObjectLevelReadQuery).buildObject(AbstractRecord) line: 723
ReadObjectQuery.registerResultInUnitOfWork(Object, UnitOfWorkImpl, AbstractRecord, boolean) line: 766
ReadObjectQuery.executeObjectLevelReadQuery() line: 451
ReadObjectQuery(ObjectLevelReadQuery).executeDatabaseQuery() line: 1080
ReadObjectQuery(DatabaseQuery).execute(AbstractSession, AbstractRecord) line: 808
ReadObjectQuery(ObjectLevelReadQuery).execute(AbstractSession, AbstractRecord) line: 1040
ReadObjectQuery.execute(AbstractSession, AbstractRecord) line: 412
ReadObjectQuery(ObjectLevelReadQuery).executeInUnitOfWork(UnitOfWorkImpl, AbstractRecord) line: 1126
RepeatableWriteUnitOfWork(UnitOfWorkImpl).internalExecuteQuery(DatabaseQuery, AbstractRecord) line: 2842
RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery, AbstractRecord, int) line: 1521
RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery, AbstractRecord) line: 1503
RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery) line: 1463
EntityManagerImpl.executeQuery(ReadObjectQuery, LockModeType, AbstractSession) line: 781
EntityManagerImpl.findInternal(ClassDescriptor, AbstractSession, Object, LockModeType, Map<String,Object>) line: 725
EntityManagerImpl.find(Class<T>, Object, LockModeType, Map<String,Object>) line: 619
EntityManagerImpl.find(Class<T>, Object) line: 498
EntityManagerWrapper.find(Class<T>, Object) line: 291
UserServiceEJB.getUserFullWithLazyProps(String, EnumSet<EnumUserLazyProps>) line: 104
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
EJBSecurityManager.runMethod(Method, Object, Object[]) line: 1011
SecurityUtil.invoke(Method, Invocation, Object, Object[], Container, SecurityManager) line: 175
StatelessSessionContainer(BaseContainer).invokeTargetBeanMethod(Method, Invocation, Object, Object[], SecurityManager) line: 2929
StatelessSessionContainer(BaseContainer).intercept(Invocation) line: 4020
EJBObjectInvocationHandler.invoke(Class, Method, Object[]) line: 203
EJBObjectInvocationHandlerDelegate.invoke(Object, Method, Object[]) line: 77
$Proxy1079.getUserFullWithLazyProps(String, EnumSet) line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
ReflectiveTie._invoke(String, InputStream, ResponseHandler) line: 154
CorbaServerRequestDispatcherImpl.dispatchToServant(Object, CorbaMessageMediator, byte[], ObjectAdapter) line: 687
CorbaServerRequestDispatcherImpl.dispatch(MessageMediator) line: 227
CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediator) line: 1846
CorbaMessageMediatorImpl.handleRequest(RequestMessage, CorbaMessageMediator) line: 1706
CorbaMessageMediatorImpl.handleInput(RequestMessage_1_2) line: 1088
RequestMessage_1_2.callback(MessageHandler) line: 223
CorbaMessageMediatorImpl.handleRequest(MessageMediator) line: 806
CorbaMessageMediatorImpl.dispatch() line: 563
CorbaMessageMediatorImpl.doWork() line: 2567
ThreadPoolImpl$WorkerThread.run() line: 555
-
Attachment: el_vars.JPG
(Size: 290.48KB, Downloaded 451 times)
|
|
| | |
Re: EmbeddedObjects - fields not populated correctly [message #670064 is a reply to message #670056] |
Thu, 12 May 2011 14:50 |
TimM Messages: 19 Registered: May 2011 |
Junior Member |
|
|
I'll try without the weaving / newer version of eclipselink in while, prob next week...
in the meantime :
the mapped superclass at the top of the heirarchy
@MappedSuperclass
public class UserTahoe extends TahoeEntity implements CloneAccessor, Serializable{
private static final long serialVersionUID = 3875580327768987028L;
@Transient
private String oprIDTransient;
etc
private String areaUnit = " ";
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="PORTFOLIO",insertable=false,updatable=false)
private Portfolio portfolio;
@Column(name="PORTFOLIO")
private String portfolioId ;
etc
@Embedded
@AttributeOverride(name="value", column=@Column(name="ACHOLLOOKUPONLY"))
private JpaBoolean acHolLookupOnly = new JpaBoolean(false) ;
@Embedded
@AttributeOverride(name="value", column=@Column(name="SUPERVISOR"))
private JpaBoolean supervisor = new JpaBoolean(false) ;
@Embedded
@AttributeOverride(name="value", column=@Column(name="BANKMANAGER"))
private JpaBoolean bankManager = new JpaBoolean(false) ;
the @Entity itself
@Entity
@Table(name="WBR_USER")
public class User extends UserTahoe implements Serializable, LiveFieldAccess, StatusFieldAccess {
etc
the embedded object
@Embeddable
public class JpaBoolean implements Serializable {
private static final long serialVersionUID = -8018836031372234990L ;
/** Value for use in query parameters to match true */
public static final String TRUE = "1";
/** Value for use in query parameters to match false */
public static final String FALSE = "0";
private String value;
|
|
| | |
Re: EmbeddedObjects - fields not populated correctly [message #671556 is a reply to message #671510] |
Wed, 18 May 2011 10:01 |
TimM Messages: 19 Registered: May 2011 |
Junior Member |
|
|
Ok - still on 2.2 at moment - same behavour with static/dynamic weaving- with weaving turned off altogether though an exception is thrown as below. Now to try latest eclipselink
[#|2011-05-18T09:56:39.237+0000|WARNING|sun-appserver2 .1|org.eclipse.persistence.session.file:/rndvm/java/domainRN DVM/applications/j2ee-apps/Bedrock-ot-norcp-gf211-el220-DEV- r000000-20110518-102934/Bedrock.server.services.local_jar/_W SSJPA|_ThreadID=14;_ThreadName=p: thread-pool-1; w: 5;_RequestID=e97976eb-5cce-4f64-be0d-be09047da258;|
Local Exception Stack:
Exception [EclipseLink-26] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Trying to get value for instance variable [value] of type [java.lang.String] from the object [biz.wss.interfaces.entities.user.User]. The specified object is not an instance of the class or interface declaring the underlying field.
Internal Exception: java.lang.IllegalArgumentException: Can not set java.lang.String field biz.wss.interfaces.entities.jpa.JpaBoolean.value to biz.wss.interfaces.entities.user.User
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[value- - >WSSDBA.WBR_USER.ACHOLLOOKUPONLY]
Descriptor: RelationalDescriptor(biz.wss.interfaces.entities.jpa.JpaBool ean --> [DatabaseTable(WSSDBA.WBR_USER)])
at org.eclipse.persistence.exceptions.DescriptorException.illeg alArgumentWhileGettingValueThruInstanceVariableAccessor(Desc riptorException.java:645)
at org.eclipse.persistence.internal.descriptors.InstanceVariabl eAttributeAccessor.getAttributeValueFromObject(InstanceVaria bleAttributeAccessor.java:79)
at org.eclipse.persistence.mappings.DatabaseMapping.getAttribut eValueFromObject(DatabaseMapping.java:523)
at org.eclipse.persistence.mappings.foundation.AbstractDirectMa pping.valueFromRow(AbstractDirectMapping.java:1273)
at org.eclipse.persistence.mappings.DatabaseMapping.readFromRow IntoObject(DatabaseMapping.java:1325)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.b uildAttributesIntoObject(ObjectBuilder.java:344)
at org.eclipse.persistence.mappings.AggregateObjectMapping.buil dAggregateFromRow(AggregateObjectMapping.java:362)
at org.eclipse.persistence.mappings.AggregateObjectMapping.read FromRowIntoObject(AggregateObjectMapping.java:1415)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.b uildAttributesIntoObject(ObjectBuilder.java:344)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.b uildProtectedObject(ObjectBuilder.java:821)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.b uildObject(ObjectBuilder.java:657)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.b uildWorkingCopyCloneNormally(ObjectBuilder.java:612)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.b uildObjectInUnitOfWork(ObjectBuilder.java:565)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.b uildObject(ObjectBuilder.java:497)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.b uildObject(ObjectBuilder.java:456)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildOb ject(ObjectLevelReadQuery.java:723)
at org.eclipse.persistence.queries.ReadObjectQuery.registerResu ltInUnitOfWork(ReadObjectQuery.java:766)
at org.eclipse.persistence.queries.ReadObjectQuery.executeObjec tLevelReadQuery(ReadObjectQuery.java:451)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute DatabaseQuery(ObjectLevelReadQuery.java:1080)
at org.eclipse.persistence.queries.DatabaseQuery.execute(Databa seQuery.java:808)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute (ObjectLevelReadQuery.java:1040)
at org.eclipse.persistence.queries.ReadObjectQuery.execute(Read ObjectQuery.java:412)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute InUnitOfWork(ObjectLevelReadQuery.java:1126)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.int ernalExecuteQuery(UnitOfWorkImpl.java:2842)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1521)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1503)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1463)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.execu teQuery(EntityManagerImpl.java:781)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.findI nternal(EntityManagerImpl.java:725)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find( EntityManagerImpl.java:619)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find( EntityManagerImpl.java:498)
at com.sun.enterprise.util.EntityManagerWrapper.find(EntityMana gerWrapper.java:291)
at biz.wss.server.services.local.user.UserServiceEJB.getUserFul lWithLazyProps(UserServiceEJB.java:104)
[Updated on: Wed, 18 May 2011 10:23] Report message to a moderator
|
|
| | | | |
Re: EmbeddedObjects - fields not populated correctly [message #673747 is a reply to message #673603] |
Tue, 24 May 2011 15:45 |
|
Are you mixing shared and none shared cached objects? i.e. do you have a reference from a shared cache object to a shared=false object?
This could be an issue with our new protected cache support in 2.2. Please log a bug for the issue with as much details as you have.
Can you try the 2.1 release, does it work in that version?
Does it work with the shared cache off for everything?
James : Wiki : Book : Blog : Twitter
|
|
| | |
Goto Forum:
Current Time: Fri Apr 19 11:22:04 GMT 2024
Powered by FUDForum. Page generated in 0.03780 seconds
|