SQLGrammarException could not fetch initial value for increment generator

In the earlier versions of Hibernate, may be hibernate 2.x, if you use increment generator on a new table then you might get this error. If you really need to use the increment generator on the new table then you need to create a dummy row on that table. This… Read more »

HibernateSystemException- Don’t change the reference to a collection with cascade=”all-delete-orphan”

This is not an error which I got. This is an error that bugged one of my friend for a few days. The error is org.springframework.orm.hibernate3.HibernateSystemException: Don’t change the reference to a collection with cascade=”all-delete-orphan”: com.test.Cat.kittens; nested exception is org.hibernate.HibernateException: Don’t change the reference to a collection with cascade=”all-delete-orphan”: com.test.Cat.kittens… Read more »

Hibernate error : org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree

Update: Look at the comments for more information and possible solutions. I got this error today. [sourcecode language=”java”] Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [select count(*) from com.test.Fruits as fruit where fruit.fruitId in () order by fruit.fruitName desc ] at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31) at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24) at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:235) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)… Read more »

Query to find the Primary Key of a table

      No Comments on Query to find the Primary Key of a table

This is the simple query which I use to find the primary key of a table. Not a rocket science. But simple and handy. Inner query version [sourcecode language=’sql’] SELECT TABLE_NAME, COLUMN_NAME PRIMARY_KEY,CONSTRAINT_NAME,OWNER FROM USER_CONS_COLUMNS UCC WHERE UCC.CONSTRAINT_NAME=( SELECT CONSTRAINT_NAME FROM USER_CONSTRAINTS UC WHERE UPPER(UC.TABLE_NAME)=UPPER(‘ADDRESS’) AND UC.CONSTRAINT_TYPE=’P’ ) [/sourcecode] Or… Read more »

Problem- java.lang.NoClassDefFoundError: javax/el/ValueExpression Tomcat

Problem- java.lang.NoClassDefFoundError: javax/el/ValueExpression Possibly you are using different set of jars at runtime and compile time. In case of tomcat you might be using some of the jars. Try adding jars like el-api.jar, javaee.jar, jstl-1.2.jar from your development environment to the Tomcat/common/lib folder, one by one and it should solve… Read more »

org.hibernate.TransientObjectException Revisited

      14 Comments on org.hibernate.TransientObjectException Revisited

This is continuation of my earlier post on org.hibernate.TransientObjectException. Let me write the scenario again <class name=”com.xxx.A” table=”A” schema=”TESTSCHEMA”> <id name=”aId” type=”java.lang.Long”> <column name=”A_ID” precision=”29″ scale=”0″ /> </id> ………………….. some more mapping elements ………………….. ………………….. <many-to-one name=”bId” class=”com.xxx.B” fetch=”select”> <column name=”B_ID” precision=”29″ scale=”0″ /> </many-to-one> ………………….. A is referring to… Read more »