-
1. Re: Prblm with associations
adamw Jun 16, 2009 8:41 AM (in response to pkseepat)Well, it's not a lot of information, maybe you could expand a bit :) For example create a testcase.
Adam -
2. Re: Prblm with associations
pkseepat Jun 16, 2009 9:22 AM (in response to pkseepat)When i save a record in CURRENTMAINTENANCE object, saves a record in corresponding CURRENTMAINTENANCE_AUD TABLE (there will be no records in MaintenanceStatus_Aud table)
IN CURRENTMAINTENANCE OBJECT I HAVE A MANYTOONE RELATION TO MAINTENANCESTATUS OBJECT
/**
* {@inheritDoc}
*/
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "maintenanceStatusId")
@ForeignKey(name = "currentmaintenance_maintenancestatus_fk")
public MaintenanceStatus getMaintenanceStatus() {
return maintenanceStatus;
}
When I make forRevisionsOfEntity call as below
List revisionList=reader.createQuery().forRevisionsOfEntity(CurrentScheduledMaintenance.class, false, true)
.add(AuditEntity.relatedId("property").eq(propertyId)).getResultList();
and when i do
Object[] objArray = (Object[]) revisionList.get(counter);
CurrentScheduledMaintenance csm = (CurrentScheduledMaintenance)
objArray[0];
csm.getMaintenanceStatus();
is null, I am not getting association values. The above query always return null assaocation values -
3. Re: Prblm with associations
pkseepat Jun 16, 2009 9:23 AM (in response to pkseepat)gets following error when i do csm.getMaintenanceStatus();
Nested in javax.servlet.ServletException: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [uk.co.valueworks.model.MaintenanceStatus#]:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [uk.co.valueworks.model.MaintenanceStatus#]
at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:409)
at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:108)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:97)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:140)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
at uk.co.valueworks.model.MaintenanceStatus_$$_javassist_31.getMaintenanceStage(MaintenanceStatus_$$_javassist_31.java)
at uk.co.valueworks.dao.hibernate.AddressAuditDAOHibernate.getCurrentMaintenanceRecords(AddressAuditDAOHibernate.java:268)
at uk.co.valueworks.dao.hibernate.AddressAuditDAOHibernate.findCurrentMaintenanceByProperty(AddressAuditDAOHibernate.java:182)
at uk.co.valueworks.service.impl.AddressAuditManagerImpl.findCurrentMaintenanceByProperty(AddressAuditManagerImpl.java:68) -
4. Re: Prblm with associations
pkseepat Jun 16, 2009 10:04 AM (in response to pkseepat)is it because no record in associated maintenancestatus_aud table?
-
5. Re: Prblm with associations
adamw Jun 16, 2009 10:07 AM (in response to pkseepat)Hello,
I don't know why this happens. Please create a testcase and open a JIRA bug.
Adam