Hibernate version: version 2.1.7
I have a class Number thas has several subclasses.
Storing a number gives no problem, but when I execute the following:
collection = session.find("FROM number");
I get the following error:
Caused by: java.sql.SQLException: Expected to find "FROM" instead found "NUMBER_3_" at position 49.
Code:
<joined-subclass
name="datastructures.syntaxtree.Number"
table="NUMBER">
<key column="NUMBER_ID"/>
<joined-subclass
name="datastructures.syntaxtree.DoubleNbr"
table="DOUBLE_NBR">
<key column="DOUBLE_NBR_ID"/>
<property name="value" column="VALUE" type="double"/>
</joined-subclass>
<joined-subclass
name="datastructures.syntaxtree.IntNbr"
table="INT_NBR">
<key column="INT_NBR_ID"/>
<property name="value" column="VALUE" type="int"/>
</joined-subclass>
<joined-subclass
name="datastructures.syntaxtree.FloatNbr"
table="FLOAT_NBR">
<key column="FLOAT_NBR_ID"/>
<property name="value" column="VALUE" type="float"/>
</joined-subclass>
<joined-subclass
name="datastructures.syntaxtree.LongNbr"
table="LONG_NBR">
<key column="LONG_NBR_ID"/>
<property name="value" column="VALUE" type="long"/>
</joined-subclass>
</joined-subclass>
Code:
Hibernate: insert into SYNTAX_TREE_COMPONENT (NAME, SYNTAX_COMPONENT_ID) values (?, ?)
Hibernate: insert into TERM (TERM_ID) values (?)
Hibernate: insert into NUMBER (NUMBER_ID) values (?)
Hibernate: insert into INT_NBR (VALUE, INT_NBR_ID) values (?, ?)
Hibernate: insert into SYNTAX_TREE_COMPONENT (NAME, SYNTAX_COMPONENT_ID) values (?, ?)
Hibernate: insert into TERM (TERM_ID) values (?)
Hibernate: insert into NUMBER (NUMBER_ID) values (?)
Hibernate: insert into INT_NBR (VALUE, INT_NBR_ID) values (?, ?)
Hibernate: insert into SYNTAX_TREE_COMPONENT (NAME, SYNTAX_COMPONENT_ID) values (?, ?)
Hibernate: insert into OPERATION (OPERATOR_TYPE, OPERATION_ID) values (?, ?)
Hibernate: insert into COMPARISON_OP (LEFT_TERM_ID, RIGHT_TERM_ID, COMPARISON_OP_ID) values (?, ?, ?)
Hibernate: insert into SYNTAX_TREE_COMPONENT (NAME, SYNTAX_COMPONENT_ID) values (?, ?)
Hibernate: insert into RULE (ACTIVE, DESCRIPTION, SCOPE_TYPE, RULE_ID) values (?, ?, ?, ?)
Hibernate: insert into CONDITIONAL_RULE (OPERATION_ID, CONDITIONAL_RULE_ID) values (?, ?)
Hibernate: select number.NUMBER_ID as SYNTAX_C1_, case when number_3_.DOUBLE_NBR_ID is not null then 1 when number_4_.INT_NBR_ID is not null then 2 when number_5_.FLOAT_NBR_ID is not null then 3 when number_6_.LONG_NBR_ID is not null then 4 when number.NUMBER_ID is not null then 0 end as clazz_, number_2_.NAME as NAME0_, number_3_.VALUE as VALUE16_, number_4_.VALUE as VALUE17_, number_5_.VALUE as VALUE18_, number_6_.VALUE as VALUE19_ from NUMBER number inner join TERM number_1_ on number.NUMBER_ID=number_1_.TERM_ID inner join SYNTAX_TREE_COMPONENT number_2_ on number.NUMBER_ID=number_2_.SYNTAX_COMPONENT_ID left outer join DOUBLE_NBR number_3_ on number.NUMBER_ID=number_3_.DOUBLE_NBR_ID left outer join INT_NBR number_4_ on number.NUMBER_ID=number_4_.INT_NBR_ID left outer join FLOAT_NBR number_5_ on number.NUMBER_ID=number_5_.FLOAT_NBR_ID left outer join LONG_NBR number_6_ on number.NUMBER_ID=number_6_.LONG_NBR_ID
02:53:15,828 WARN JDBCExceptionReporter:57 - SQL Error: 10006, SQLState: ZB005
02:53:15,828 ERROR JDBCExceptionReporter:58 - Expected to find "FROM" instead found "NUMBER_3_" at position 49.
02:53:15,828 WARN JDBCExceptionReporter:57 - SQL Error: 10006, SQLState: ZB005
02:53:15,859 ERROR JDBCExceptionReporter:58 - Expected to find "FROM" instead found "NUMBER_3_" at position 49.
net.sf.hibernate.exception.GenericJDBCException: Could not execute query
at net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:81)
at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1556)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1530)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1522)
at servicesimpl.RuleManagerImpl.retrieveAllRules(RuleManagerImpl.java:182)
at servicesimpl.RuleManagerImpl.main(RuleManagerImpl.java:239)
Caused by: java.sql.SQLException: Expected to find "FROM" instead found "NUMBER_3_" at position 49.
at com.pointbase.net.netJDBCPrimitives.handleResponse(Unknown Source)
at com.pointbase.net.netJDBCPrimitives.handleJDBCObjectResponse(Unknown Source)
at com.pointbase.net.netJDBCConnection.prepareStatement(Unknown Source)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:260)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:235)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:66)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:779)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553)
... 4 more
java.lang.NullPointerException
at servicesimpl.RuleManagerImpl.main(RuleManagerImpl.java:240)
select number.NUMBER_ID as SYNTAX_C1_, case when number_3_.DOUBLE_NBR_ID is not null then 1 when number_4_.INT_NBR_ID is not null then 2 when number_5_.FLOAT_NBR_ID is not null then 3 when number_6_.LONG_NBR_ID is not null then 4 when number.NUMBER_ID is not null then 0 end as clazz_, number_2_.NAME as NAME0_, number_3_.VALUE as VALUE16_, number_4_.VALUE as VALUE17_, number_5_.VALUE as VALUE18_, number_6_.VALUE as VALUE19_ from NUMBER number inner join TERM number_1_ on number.NUMBER_ID=number_1_.TERM_ID inner join SYNTAX_TREE_COMPONENT number_2_ on number.NUMBER_ID=number_2_.SYNTAX_COMPONENT_ID left outer join DOUBLE_NBR number_3_ on number.NUMBER_ID=number_3_.DOUBLE_NBR_ID left outer join INT_NBR number_4_ on number.NUMBER_ID=number_4_.INT_NBR_ID left outer join FLOAT_NBR number_5_ on number.NUMBER_ID=number_5_.FLOAT_NBR_ID left outer join LONG_NBR number_6_ on number.NUMBER_ID=number_6_.LONG_NBR_ID