gemire / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 1 forks source link

Positional Parameters syntax in Query using JPA DAO #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
NOTE: If you have a question rather than a bug report or feature request,
please post at http://groups.google.com/group/java-generic-dao .

What steps will reproduce the problem?
1.Persist object in DB
2.Delete object using the method removeById(id)
3.

What is the expected output? What do you see instead?
Expected output is that the object will be removed from the DB. Instead, I get 
an exception from ObjectDB saying, [ObjectDB 2.2.6] 
javax.persistence.PersistenceException
Unexpected query expression end (error 751)
 (position 13)    at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:592)

What version of the product are you using? On what operating system?
I'm using version 1.0.0 on Windows 7 64bit

Please provide any additional information below.
The bug is in the positional parameter syntax in JPABaseDAO.java in line 112: 
query is:
Query query = em().createQuery("select _it_.id from " + 
getMetadataUtil().get(type).getEntityName() + " _it_ where _it_.id = 
?").setParameter(1, id);

and should be(Note added 1 after ?)
Query query = em().createQuery("select _it_.id from " + 
getMetadataUtil().get(type).getEntityName() + " _it_ where _it_.id = 
?1").setParameter(1, id);

And I suspect the same bug in lines 516 and 518.

Thanks

Original issue reported on code.google.com by eit...@gmail.com on 2 Jun 2011 at 11:27

GoogleCodeExporter commented 9 years ago

Original comment by dwolvert on 26 Jun 2011 at 1:43

GoogleCodeExporter commented 9 years ago

Original comment by dwolvert on 26 Jun 2011 at 2:05

GoogleCodeExporter commented 9 years ago

Original comment by dwolvert on 1 Oct 2011 at 10:56