Hi,
Is it possible for a named sql query return Integer object?
Code:
<sql-query name="findLogicalSequence">
<return class="java.lang.Integer">
</return>
select max(metaobjectno) + 1 as metaobjectno from metaobject where structureno = :structureno
</sql-query>
I tried with above definition and as expected, it threw an exception as
Code:
Caused by: org.hibernate.MappingException: Unknown entity: java.lang.Integer
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:569)
at org.hibernate.loader.custom.SQLQueryReturnProcessor.getSQLLoadable(SQLQueryReturnProcessor.java:53)
at org.hibernate.loader.custom.SQLQueryReturnProcessor.processRootReturn(SQLQueryReturnProcessor.java:119)
at org.hibernate.loader.custom.SQLQueryReturnProcessor.processReturn(SQLQueryReturnProcessor.java:98)
at org.hibernate.loader.custom.SQLQueryReturnProcessor.process(SQLQueryReturnProcessor.java:87)
at org.hibernate.loader.custom.SQLCustomQuery.<init>(SQLCustomQuery.java:105)