syntax « Test « JPA Q&A





1. JUnit/HSQLDB: How to get around errors with Oracle syntax when testing using HSQLDB (no privilege and/or no DUAL object)    stackoverflow.com

I have DAO code which contains some JDBC with Oracle-specific syntax, for example:

select count(*) cnt from DUAL 
where exists (select null from " + TABLE_NAME + "
     ...

2. MySQL syntax error when testing collection size    forum.hibernate.org

I have a Hibernate class like this: public class Resource { public Set getUsers() { ... } } I want to get all Resources that have no users. I tried two method, but both failed with MySQL syntax error (1) HQL: "from Resource where users.size=0" Translated SQL sth like: "select * from Resource where (select count(*) from ResourceUsers where Resource.id=ResourceUsers.resource_id)=0" Error ...

3. Query properly generated but I get syntax error in my test    forum.hibernate.org

Hi Im using hibernate and spring to connect to oracle 10g, the driver im using is ojdbc6.jar I have tested ojdbc5.jar too Im testing this dao package test.acw.dao.hibernate; import java.sql.SQLException; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import my.test.dao.TestDao; import my.test.dao.search.GenericSearchResult; import my.test.dao.search.SearchArgumentSupport; import my.test.domain.Test; import my.test.domain.dto.TestDto; public class TestDaoImpl extends HibernateDaoSupport ...