openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adil <adiltha...@hotmail.com>
Subject Re: Null field not persisted for Dates
Date Tue, 13 May 2014 17:40:49 GMT
Hi,

I have tried <property name="openjpa.DetachState" 
value="fetch-groups"/>  and it worked fine. but the problem is if i want to
update on field, for that in persistenceObject i populate one field, rest
are null. it will cause problem. Do we have any solution to apply this
behavior on specific field instead of complete JPA entities.

I have tried below code but didn't work for me(persistence.xml
openjpa.DetachState property was not set for below code).

*@Entity
@Table(name="EMPLOYEE")
@FetchGroups({
	@FetchGroup(name="employeeDateFetchGroup", attributes={
			@FetchAttribute(name="employeeDate")
	})
})
class Employee{
.....
}
*

and Persistence DAO Layer code:

*Query query = entityManager.createQuery(EMPLOYEE_RETRIEVE_SQL);
			query.setParameter("employeeId", identifier);		
			OpenJPAQuery kq = OpenJPAPersistence.cast(query);
		
kq.getFetchPlan().setMaxFetchDepth(3).addFetchGroup("employeeDateFetchGroup");
			persistentObject = (AppliedFirearmPO)kq.getSingleResult();*



--
View this message in context: http://openjpa.208410.n2.nabble.com/Null-field-not-persisted-for-Dates-tp5993519p7586404.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message