You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Try to save an hibernate proxy object not in the Session. Here is a test
case :
public void testUpdateProxy() throws HibernateException, SecurityException,
NoSuchMethodException {
initDB();
Address address = papaA.getHome().getAddress();
try {
Serializable id = address.getId();
// When working with 2 differents session, the session.contains(entity)
returns false
// see in _exists(Object entity) in HibernateBaseDAO
SessionImplementor openSession = (SessionImplementor)
target.getSessionFactory().openSession();
Address proxy = (Address) JavassistLazyInitializer.getProxy(
Address.class.getName(),
Address.class,
new Class[] { HibernateProxy.class },
Address.class.getMethod("getId"),
Address.class.getMethod("setId", Long.class),
new AnyType(Hibernate.LONG, Hibernate.SERIALIZABLE),
id,
openSession
);
target.saveOrUpdateIsNew(proxy);
Address address2 = target.get(Address.class, id);
assertEquals("update on the proxy should work ", proxy.getCity(),
address2.getCity());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
What is the expected output? What do you see instead?
The test should pass.
WARN 2009-10-01 14:42:22.285 org.hibernate.hql.QuerySplitter.concreteQueries()
no persistent classes found for query class: select id from
test.trg.model.Address_$$_javassist_5 where id = :id
org.hibernate.QueryParameterException: could not locate named parameter [id]
at
org.hibernate.engine.query.ParameterMetadata.getNamedParameterDescriptor(Paramet
erMetadata.java:99)
at
org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(Param
eterMetadata.java:105)
at
org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:437)
at
org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:407)
at com.trg.dao.hibernate.HibernateBaseDAO._exists(HibernateBaseDAO.java:634)
at com.trg.dao.hibernate.HibernateBaseDAO._exists(HibernateBaseDAO.java:623)
at
com.trg.dao.hibernate.HibernateBaseDAO._saveOrUpdateIsNew(HibernateBaseDAO.java:
163)
at
test.trg.dao.hibernate.HibernateBaseDAOTester.saveOrUpdateIsNew(HibernateBaseDAO
Tester.java:165)
What version of the product are you using? On what operating system?
trg-dao 0.5.0
I join a patch that corrects the problem.
P.S. : how can we contribute to the code ?
Original issue reported on code.google.com by mathieu....@gmail.com on 1 Oct 2009 at 12:49
Original issue reported on code.google.com by
mathieu....@gmail.com
on 1 Oct 2009 at 12:49Attachments:
The text was updated successfully, but these errors were encountered: