From: Steve E. <ste...@jb...> - 2006-06-19 15:22:43
|
>From my understanding in discussions with Max, auto-discovery is illegal once any returns have been defined/added. Max, can you clarify here? Thinking some more about it, maybe you just meant the column name discovery (as it should be possible to still auto-discover types in this scenario)? Also, in general, we need to make certain that these types of "integration point tests" are defined within the Hibernate test suite proper so that we can catch these discrepancies earlier... -----Original Message----- From: hib...@li... [mailto:hib...@li...] On Behalf Of Emmanuel Bernard Sent: Sunday, June 18, 2006 10:21 PM To: Hibernate development Subject: [Hibernate] New error on Annotation query Has something changed that I haven't propagated in my code? org.hibernate.HibernateException: cannot perform autodiscovery on=20 queries with non-scalar results at=20 org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. performDiscovery(CustomLoader.java:453) at=20 org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. java:511) at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at=20 org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade r.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2144) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) at=20 org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 ) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) at=20 org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi tePKAndComponents(QueryTest.java:195) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at=20 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at=20 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) at=20 com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at=20 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at=20 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) @NamedNativeQuery(name =3D "compositekey", query =3D "select name, model, speed, lname as lastn, fname as=20 firstn, length, width, length * width as surface, length * width *10 as=20 volume from SpaceShip", resultSetMapping =3D "compositekey") } @SqlResultSetMapping(name =3D "compositekey", entities =3D @EntityResult(entityClass =3D=20 org.hibernate.test.annotations.query.SpaceShip.class, fields =3D { @FieldResult(name =3D "name", column =3D "name"), @FieldResult(name =3D "model", column =3D "model"), @FieldResult(name =3D "speed", column =3D "speed"), @FieldResult(name =3D "dimensions.width", column =3D "width"), @FieldResult(name =3D "captain.lastname", column =3D "lastn"), @FieldResult(name =3D "dimensions.length", column =3D "length"), @FieldResult(name =3D "captain.firstname", column =3D "firstn") }), columns =3D {@ColumnResult(name =3D "surface"), @ColumnResult(name =3D "volume")}) _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Steve E. <ste...@jb...> - 2006-06-21 19:45:14
|
Try it again from SVN. -----Original Message----- From: hib...@li... [mailto:hib...@li...] On Behalf Of Emmanuel Bernard Sent: Sunday, June 18, 2006 10:21 PM To: Hibernate development Subject: [Hibernate] New error on Annotation query Has something changed that I haven't propagated in my code? org.hibernate.HibernateException: cannot perform autodiscovery on=20 queries with non-scalar results at=20 org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. performDiscovery(CustomLoader.java:453) at=20 org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. java:511) at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at=20 org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade r.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2144) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) at=20 org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 ) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) at=20 org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi tePKAndComponents(QueryTest.java:195) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at=20 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at=20 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) at=20 com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at=20 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at=20 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) @NamedNativeQuery(name =3D "compositekey", query =3D "select name, model, speed, lname as lastn, fname as=20 firstn, length, width, length * width as surface, length * width *10 as=20 volume from SpaceShip", resultSetMapping =3D "compositekey") } @SqlResultSetMapping(name =3D "compositekey", entities =3D @EntityResult(entityClass =3D=20 org.hibernate.test.annotations.query.SpaceShip.class, fields =3D { @FieldResult(name =3D "name", column =3D "name"), @FieldResult(name =3D "model", column =3D "model"), @FieldResult(name =3D "speed", column =3D "speed"), @FieldResult(name =3D "dimensions.width", column =3D "width"), @FieldResult(name =3D "captain.lastname", column =3D "lastn"), @FieldResult(name =3D "dimensions.length", column =3D "length"), @FieldResult(name =3D "captain.firstname", column =3D "firstn") }), columns =3D {@ColumnResult(name =3D "surface"), @ColumnResult(name =3D "volume")}) _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Emmanuel B. <emm...@hi...> - 2006-06-21 20:41:32
|
The initial issue is fixed, But now I do have some weird type conversion using HSQLDB (didn't tried the other ones). basically I do have public Dimension() { private int length; private int width; } ints are converted into INTEGER types at the DB level, fine The following native SQL query, mapped using scalar autodiscovery select length * width as surface, length * width * 10 as volume ... returns String for the first argument and Double for the second The same query used to return BigInteger for the first one and BigDecimal for the second. Steve Ebersole wrote: > > Try it again from SVN. > > -----Original Message----- > From: hib...@li... > [mailto:hib...@li...] On Behalf Of > Emmanuel Bernard > Sent: Sunday, June 18, 2006 10:21 PM > To: Hibernate development > Subject: [Hibernate] New error on Annotation query > > Has something changed that I haven't propagated in my code? > > > org.hibernate.HibernateException: cannot perform autodiscovery on > queries with non-scalar results > at > org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. > performDiscovery(CustomLoader.java:453) > at > org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. > java:511) > at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) > at org.hibernate.loader.Loader.doQuery(Loader.java:662) > at > org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade > r.java:224) > at org.hibernate.loader.Loader.doList(Loader.java:2144) > at > org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) > at org.hibernate.loader.Loader.list(Loader.java:2023) > at > org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) > at > org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) > at > org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 > ) > at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) > at > org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi > tePKAndComponents(QueryTest.java:195) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > a:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > Impl.java:25) > at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) > at > com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > a:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > Impl.java:25) > at > com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) > > > > @NamedNativeQuery(name = "compositekey", > query = "select name, model, speed, lname as lastn, fname as > firstn, length, width, length * width as surface, length * width *10 as > volume from SpaceShip", > resultSetMapping = "compositekey") > } > > > @SqlResultSetMapping(name = "compositekey", > entities = @EntityResult(entityClass = > org.hibernate.test.annotations.query.SpaceShip.class, > fields = { > @FieldResult(name = "name", column = "name"), > @FieldResult(name = "model", column = "model"), > @FieldResult(name = "speed", column = "speed"), > @FieldResult(name = "dimensions.width", column = > "width"), > @FieldResult(name = "captain.lastname", column = > "lastn"), > @FieldResult(name = "dimensions.length", column = > "length"), > @FieldResult(name = "captain.firstname", column = > "firstn") > }), > columns = {@ColumnResult(name = "surface"), > @ColumnResult(name = "volume")}) > > > > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > |
From: Max R. A. <max...@jb...> - 2006-06-21 20:53:46
|
This should be controlled by calls to Dialect.registerHibernateType() an= d = whatever the underlying db returns. This has not changed afaik. /max > The initial issue is fixed, > But now I do have some weird type conversion using HSQLDB (didn't trie= d > the other ones). > > basically I do have > public Dimension() { > private int length; > private int width; > } > > ints are converted into INTEGER types at the DB level, fine > > The following native SQL query, mapped using scalar autodiscovery > select length * width as surface, length * width * 10 as volume ... > > returns String for the first argument and Double for the second > The same query used to return BigInteger for the first one and > BigDecimal for the second. > > > > Steve Ebersole wrote: >> >> Try it again from SVN. >> >> -----Original Message----- >> From: hib...@li... >> [mailto:hib...@li...] On Behalf Of >> Emmanuel Bernard >> Sent: Sunday, June 18, 2006 10:21 PM >> To: Hibernate development >> Subject: [Hibernate] New error on Annotation query >> >> Has something changed that I haven't propagated in my code? >> >> >> org.hibernate.HibernateException: cannot perform autodiscovery on >> queries with non-scalar results >> at >> org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcess= or. >> performDiscovery(CustomLoader.java:453) >> at >> org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoad= er. >> java:511) >> at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) >> at org.hibernate.loader.Loader.doQuery(Loader.java:662) >> at >> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo= ade >> r.java:224) >> at org.hibernate.loader.Loader.doList(Loader.java:2144) >> at >> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) >> at org.hibernate.loader.Loader.list(Loader.java:2023) >> at >> org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) >> at >> org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)= >> at >> org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:= 142 >> ) >> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) >> at >> org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComp= osi >> tePKAndComponents(QueryTest.java:195) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.= jav >> a:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces= sor >> Impl.java:25) >> at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:= 67) >> at >> com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:= 32) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.= jav >> a:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces= sor >> Impl.java:25) >> at >> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >> >> >> >> @NamedNativeQuery(name =3D "compositekey", >> query =3D "select name, model, speed, lname as lastn, fname a= s >> firstn, length, width, length * width as surface, length * width *10 = as >> volume from SpaceShip", >> resultSetMapping =3D "compositekey") >> } >> >> >> @SqlResultSetMapping(name =3D "compositekey", >> entities =3D @EntityResult(entityClass =3D >> org.hibernate.test.annotations.query.SpaceShip.class, >> fields =3D { >> @FieldResult(name =3D "name", column =3D "name"), >> @FieldResult(name =3D "model", column =3D "model"), >> @FieldResult(name =3D "speed", column =3D "speed"), >> @FieldResult(name =3D "dimensions.width", column =3D >> "width"), >> @FieldResult(name =3D "captain.lastname", column =3D >> "lastn"), >> @FieldResult(name =3D "dimensions.length", column =3D= >> "length"), >> @FieldResult(name =3D "captain.firstname", column =3D= >> "firstn") >> }), >> columns =3D {@ColumnResult(name =3D "surface"), >> @ColumnResult(name =3D "volume")}) >> >> >> >> _______________________________________________ >> hibernate-devel mailing list >> hib...@li... >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >> > > > All the advantages of Linux Managed Hosting--Without the Cost and Risk= ! > Fully trained technicians. The highest number of Red Hat certification= s = > in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&da= t=3D121642 > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel -- = -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate ma...@hi... http://hibernate.org JBoss Inc max...@jb... |
From: Max R. A. <max...@jb...> - 2006-06-21 20:54:32
|
btw. does the spec say about the conversion rules for this ? /max > The initial issue is fixed, > But now I do have some weird type conversion using HSQLDB (didn't trie= d > the other ones). > > basically I do have > public Dimension() { > private int length; > private int width; > } > > ints are converted into INTEGER types at the DB level, fine > > The following native SQL query, mapped using scalar autodiscovery > select length * width as surface, length * width * 10 as volume ... > > returns String for the first argument and Double for the second > The same query used to return BigInteger for the first one and > BigDecimal for the second. > > > > Steve Ebersole wrote: >> >> Try it again from SVN. >> >> -----Original Message----- >> From: hib...@li... >> [mailto:hib...@li...] On Behalf Of >> Emmanuel Bernard >> Sent: Sunday, June 18, 2006 10:21 PM >> To: Hibernate development >> Subject: [Hibernate] New error on Annotation query >> >> Has something changed that I haven't propagated in my code? >> >> >> org.hibernate.HibernateException: cannot perform autodiscovery on >> queries with non-scalar results >> at >> org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcess= or. >> performDiscovery(CustomLoader.java:453) >> at >> org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoad= er. >> java:511) >> at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) >> at org.hibernate.loader.Loader.doQuery(Loader.java:662) >> at >> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo= ade >> r.java:224) >> at org.hibernate.loader.Loader.doList(Loader.java:2144) >> at >> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) >> at org.hibernate.loader.Loader.list(Loader.java:2023) >> at >> org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) >> at >> org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)= >> at >> org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:= 142 >> ) >> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) >> at >> org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComp= osi >> tePKAndComponents(QueryTest.java:195) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.= jav >> a:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces= sor >> Impl.java:25) >> at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:= 67) >> at >> com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:= 32) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.= jav >> a:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces= sor >> Impl.java:25) >> at >> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >> >> >> >> @NamedNativeQuery(name =3D "compositekey", >> query =3D "select name, model, speed, lname as lastn, fname a= s >> firstn, length, width, length * width as surface, length * width *10 = as >> volume from SpaceShip", >> resultSetMapping =3D "compositekey") >> } >> >> >> @SqlResultSetMapping(name =3D "compositekey", >> entities =3D @EntityResult(entityClass =3D >> org.hibernate.test.annotations.query.SpaceShip.class, >> fields =3D { >> @FieldResult(name =3D "name", column =3D "name"), >> @FieldResult(name =3D "model", column =3D "model"), >> @FieldResult(name =3D "speed", column =3D "speed"), >> @FieldResult(name =3D "dimensions.width", column =3D >> "width"), >> @FieldResult(name =3D "captain.lastname", column =3D >> "lastn"), >> @FieldResult(name =3D "dimensions.length", column =3D= >> "length"), >> @FieldResult(name =3D "captain.firstname", column =3D= >> "firstn") >> }), >> columns =3D {@ColumnResult(name =3D "surface"), >> @ColumnResult(name =3D "volume")}) >> >> >> >> _______________________________________________ >> hibernate-devel mailing list >> hib...@li... >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >> > > > All the advantages of Linux Managed Hosting--Without the Cost and Risk= ! > Fully trained technicians. The highest number of Red Hat certification= s = > in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&da= t=3D121642 > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel -- = -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate ma...@hi... http://hibernate.org JBoss Inc max...@jb... |
From: Steve E. <ste...@jb...> - 2006-06-21 20:55:25
|
I am creating a similar test in the core testsuite and see if I can reproduce. -----Original Message----- From: Max Andersen=20 Sent: Wednesday, June 21, 2006 3:53 PM To: Emmanuel Bernard; Steve Ebersole Cc: Hibernate development Subject: Re: [Hibernate] New error on Annotation query This should be controlled by calls to Dialect.registerHibernateType() and =20 whatever the underlying db returns. This has not changed afaik. /max > The initial issue is fixed, > But now I do have some weird type conversion using HSQLDB (didn't tried > the other ones). > > basically I do have > public Dimension() { > private int length; > private int width; > } > > ints are converted into INTEGER types at the DB level, fine > > The following native SQL query, mapped using scalar autodiscovery > select length * width as surface, length * width * 10 as volume ... > > returns String for the first argument and Double for the second > The same query used to return BigInteger for the first one and > BigDecimal for the second. > > > > Steve Ebersole wrote: >> >> Try it again from SVN. >> >> -----Original Message----- >> From: hib...@li... >> [mailto:hib...@li...] On Behalf Of >> Emmanuel Bernard >> Sent: Sunday, June 18, 2006 10:21 PM >> To: Hibernate development >> Subject: [Hibernate] New error on Annotation query >> >> Has something changed that I haven't propagated in my code? >> >> >> org.hibernate.HibernateException: cannot perform autodiscovery on >> queries with non-scalar results >> at >> org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. >> performDiscovery(CustomLoader.java:453) >> at >> org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. >> java:511) >> at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) >> at org.hibernate.loader.Loader.doQuery(Loader.java:662) >> at >> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade >> r.java:224) >> at org.hibernate.loader.Loader.doList(Loader.java:2144) >> at >> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) >> at org.hibernate.loader.Loader.list(Loader.java:2023) >> at >> org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) >> at >> org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) >> at >> org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 >> ) >> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) >> at >> org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi >> tePKAndComponents(QueryTest.java:195) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav >> a:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor >> Impl.java:25) >> at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) >> at >> com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav >> a:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor >> Impl.java:25) >> at >> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >> >> >> >> @NamedNativeQuery(name =3D "compositekey", >> query =3D "select name, model, speed, lname as lastn, fname = as >> firstn, length, width, length * width as surface, length * width *10 as >> volume from SpaceShip", >> resultSetMapping =3D "compositekey") >> } >> >> >> @SqlResultSetMapping(name =3D "compositekey", >> entities =3D @EntityResult(entityClass =3D >> org.hibernate.test.annotations.query.SpaceShip.class, >> fields =3D { >> @FieldResult(name =3D "name", column =3D "name"), >> @FieldResult(name =3D "model", column =3D "model"), >> @FieldResult(name =3D "speed", column =3D "speed"), >> @FieldResult(name =3D "dimensions.width", column =3D >> "width"), >> @FieldResult(name =3D "captain.lastname", column =3D >> "lastn"), >> @FieldResult(name =3D "dimensions.length", column =3D >> "length"), >> @FieldResult(name =3D "captain.firstname", column =3D >> "firstn") >> }), >> columns =3D {@ColumnResult(name =3D "surface"), >> @ColumnResult(name =3D "volume")}) >> >> >> >> _______________________________________________ >> hibernate-devel mailing list >> hib...@li... >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >> > > > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications =20 > in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat=3D= 121642 > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel --=20 -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate ma...@hi... http://hibernate.org JBoss Inc max...@jb... |
From: Steve E. <ste...@jb...> - 2006-06-21 21:11:00
|
I just ran this on Oracle-10g and HSQLDB and both worked fine for me. On Oracle, the discovered types were BigDecimalType and BigDecimalType. On HSQLDB, the discovered types were BigIntegerType and BigDecimalType -----Original Message----- From: hib...@li... [mailto:hib...@li...] On Behalf Of Steve Ebersole Sent: Wednesday, June 21, 2006 3:55 PM To: Max Andersen; Emmanuel Bernard Cc: Hibernate development Subject: Re: [Hibernate] New error on Annotation query I am creating a similar test in the core testsuite and see if I can reproduce. -----Original Message----- From: Max Andersen=20 Sent: Wednesday, June 21, 2006 3:53 PM To: Emmanuel Bernard; Steve Ebersole Cc: Hibernate development Subject: Re: [Hibernate] New error on Annotation query This should be controlled by calls to Dialect.registerHibernateType() and =20 whatever the underlying db returns. This has not changed afaik. /max > The initial issue is fixed, > But now I do have some weird type conversion using HSQLDB (didn't tried > the other ones). > > basically I do have > public Dimension() { > private int length; > private int width; > } > > ints are converted into INTEGER types at the DB level, fine > > The following native SQL query, mapped using scalar autodiscovery > select length * width as surface, length * width * 10 as volume ... > > returns String for the first argument and Double for the second > The same query used to return BigInteger for the first one and > BigDecimal for the second. > > > > Steve Ebersole wrote: >> >> Try it again from SVN. >> >> -----Original Message----- >> From: hib...@li... >> [mailto:hib...@li...] On Behalf Of >> Emmanuel Bernard >> Sent: Sunday, June 18, 2006 10:21 PM >> To: Hibernate development >> Subject: [Hibernate] New error on Annotation query >> >> Has something changed that I haven't propagated in my code? >> >> >> org.hibernate.HibernateException: cannot perform autodiscovery on >> queries with non-scalar results >> at >> org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. >> performDiscovery(CustomLoader.java:453) >> at >> org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. >> java:511) >> at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) >> at org.hibernate.loader.Loader.doQuery(Loader.java:662) >> at >> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade >> r.java:224) >> at org.hibernate.loader.Loader.doList(Loader.java:2144) >> at >> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) >> at org.hibernate.loader.Loader.list(Loader.java:2023) >> at >> org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) >> at >> org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) >> at >> org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 >> ) >> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) >> at >> org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi >> tePKAndComponents(QueryTest.java:195) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav >> a:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor >> Impl.java:25) >> at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) >> at >> com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav >> a:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor >> Impl.java:25) >> at >> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >> >> >> >> @NamedNativeQuery(name =3D "compositekey", >> query =3D "select name, model, speed, lname as lastn, fname = as >> firstn, length, width, length * width as surface, length * width *10 as >> volume from SpaceShip", >> resultSetMapping =3D "compositekey") >> } >> >> >> @SqlResultSetMapping(name =3D "compositekey", >> entities =3D @EntityResult(entityClass =3D >> org.hibernate.test.annotations.query.SpaceShip.class, >> fields =3D { >> @FieldResult(name =3D "name", column =3D "name"), >> @FieldResult(name =3D "model", column =3D "model"), >> @FieldResult(name =3D "speed", column =3D "speed"), >> @FieldResult(name =3D "dimensions.width", column =3D >> "width"), >> @FieldResult(name =3D "captain.lastname", column =3D >> "lastn"), >> @FieldResult(name =3D "dimensions.length", column =3D >> "length"), >> @FieldResult(name =3D "captain.firstname", column =3D >> "firstn") >> }), >> columns =3D {@ColumnResult(name =3D "surface"), >> @ColumnResult(name =3D "volume")}) >> >> >> >> _______________________________________________ >> hibernate-devel mailing list >> hib...@li... >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >> > > > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications =20 > in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat=3D= 121642 > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel --=20 -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate ma...@hi... http://hibernate.org JBoss Inc max...@jb... All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat=3D= 121642 _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Emmanuel B. <emm...@hi...> - 2006-06-21 21:59:43
|
My description was too generic. I've updated the GeneralTest by adding a SpaceShip class. It now fails with the error I encountered. Steve Ebersole wrote: > I just ran this on Oracle-10g and HSQLDB and both worked fine for me. > > On Oracle, the discovered types were BigDecimalType and BigDecimalType. > > On HSQLDB, the discovered types were BigIntegerType and BigDecimalType > > -----Original Message----- > From: hib...@li... > [mailto:hib...@li...] On Behalf Of > Steve Ebersole > Sent: Wednesday, June 21, 2006 3:55 PM > To: Max Andersen; Emmanuel Bernard > Cc: Hibernate development > Subject: Re: [Hibernate] New error on Annotation query > > I am creating a similar test in the core testsuite and see if I can > reproduce. > > -----Original Message----- > From: Max Andersen > Sent: Wednesday, June 21, 2006 3:53 PM > To: Emmanuel Bernard; Steve Ebersole > Cc: Hibernate development > Subject: Re: [Hibernate] New error on Annotation query > > > This should be controlled by calls to Dialect.registerHibernateType() > and > whatever the underlying db returns. > > This has not changed afaik. > > /max > > >> The initial issue is fixed, >> But now I do have some weird type conversion using HSQLDB (didn't >> > tried > >> the other ones). >> >> basically I do have >> public Dimension() { >> private int length; >> private int width; >> } >> >> ints are converted into INTEGER types at the DB level, fine >> >> The following native SQL query, mapped using scalar autodiscovery >> select length * width as surface, length * width * 10 as volume ... >> >> returns String for the first argument and Double for the second >> The same query used to return BigInteger for the first one and >> BigDecimal for the second. >> >> >> >> Steve Ebersole wrote: >> >>> Try it again from SVN. >>> >>> -----Original Message----- >>> From: hib...@li... >>> [mailto:hib...@li...] On Behalf Of >>> Emmanuel Bernard >>> Sent: Sunday, June 18, 2006 10:21 PM >>> To: Hibernate development >>> Subject: [Hibernate] New error on Annotation query >>> >>> Has something changed that I haven't propagated in my code? >>> >>> >>> org.hibernate.HibernateException: cannot perform autodiscovery on >>> queries with non-scalar results >>> at >>> >>> > org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. > >>> performDiscovery(CustomLoader.java:453) >>> at >>> >>> > org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. > >>> java:511) >>> at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) >>> at org.hibernate.loader.Loader.doQuery(Loader.java:662) >>> at >>> >>> > org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade > >>> r.java:224) >>> at org.hibernate.loader.Loader.doList(Loader.java:2144) >>> at >>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) >>> at org.hibernate.loader.Loader.list(Loader.java:2023) >>> at >>> org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) >>> at >>> org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) >>> at >>> >>> > org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 > >>> ) >>> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) >>> at >>> >>> > org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi > >>> tePKAndComponents(QueryTest.java:195) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> >>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > >>> a:39) >>> at >>> >>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > >>> Impl.java:25) >>> at >>> > org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) > >>> at >>> >>> > com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) > >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> >>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > >>> a:39) >>> at >>> >>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > >>> Impl.java:25) >>> at >>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >>> >>> >>> >>> @NamedNativeQuery(name = "compositekey", >>> query = "select name, model, speed, lname as lastn, fname as >>> firstn, length, width, length * width as surface, length * width *10 >>> > as > >>> volume from SpaceShip", >>> resultSetMapping = "compositekey") >>> } >>> >>> >>> @SqlResultSetMapping(name = "compositekey", >>> entities = @EntityResult(entityClass = >>> org.hibernate.test.annotations.query.SpaceShip.class, >>> fields = { >>> @FieldResult(name = "name", column = "name"), >>> @FieldResult(name = "model", column = "model"), >>> @FieldResult(name = "speed", column = "speed"), >>> @FieldResult(name = "dimensions.width", column = >>> "width"), >>> @FieldResult(name = "captain.lastname", column = >>> "lastn"), >>> @FieldResult(name = "dimensions.length", column = >>> "length"), >>> @FieldResult(name = "captain.firstname", column = >>> "firstn") >>> }), >>> columns = {@ColumnResult(name = "surface"), >>> @ColumnResult(name = "volume")}) >>> >>> >>> >>> _______________________________________________ >>> hibernate-devel mailing list >>> hib...@li... >>> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >>> >>> >> All the advantages of Linux Managed Hosting--Without the Cost and >> > Risk! > >> Fully trained technicians. The highest number of Red Hat >> > certifications > >> in >> the hosting industry. Fanatical Support. Click to learn more >> >> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > >> _______________________________________________ >> hibernate-devel mailing list >> hib...@li... >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >> > > > > |
From: Steve E. <ste...@jb...> - 2006-06-22 20:37:35
|
On Oracle10g it actually returns String for both of the scalars. Not sure what you want to have happen here. The ResultSetMetaData explicitly reports columnType =3D 12 (java.sql.Types.VARCHAR) for both = of these columns. It's not like I can return numerics for all columnType = =3D 12 auto-discoveries... -----Original Message----- From: Emmanuel Bernard [mailto:emm...@hi...]=20 Sent: Wednesday, June 21, 2006 4:59 PM To: Steve Ebersole Cc: Hibernate development Subject: Re: [Hibernate] New error on Annotation query My description was too generic. I've updated the GeneralTest by adding a SpaceShip class. It now fails with the error I encountered. Steve Ebersole wrote: > I just ran this on Oracle-10g and HSQLDB and both worked fine for me. > > On Oracle, the discovered types were BigDecimalType and BigDecimalType. > > On HSQLDB, the discovered types were BigIntegerType and BigDecimalType > > -----Original Message----- > From: hib...@li... > [mailto:hib...@li...] On Behalf Of > Steve Ebersole > Sent: Wednesday, June 21, 2006 3:55 PM > To: Max Andersen; Emmanuel Bernard > Cc: Hibernate development > Subject: Re: [Hibernate] New error on Annotation query > > I am creating a similar test in the core testsuite and see if I can > reproduce. > > -----Original Message----- > From: Max Andersen=20 > Sent: Wednesday, June 21, 2006 3:53 PM > To: Emmanuel Bernard; Steve Ebersole > Cc: Hibernate development > Subject: Re: [Hibernate] New error on Annotation query > > > This should be controlled by calls to Dialect.registerHibernateType() > and =20 > whatever the underlying db returns. > > This has not changed afaik. > > /max > > =20 >> The initial issue is fixed, >> But now I do have some weird type conversion using HSQLDB (didn't >> =20 > tried > =20 >> the other ones). >> >> basically I do have >> public Dimension() { >> private int length; >> private int width; >> } >> >> ints are converted into INTEGER types at the DB level, fine >> >> The following native SQL query, mapped using scalar autodiscovery >> select length * width as surface, length * width * 10 as volume ... >> >> returns String for the first argument and Double for the second >> The same query used to return BigInteger for the first one and >> BigDecimal for the second. >> >> >> >> Steve Ebersole wrote: >> =20 >>> Try it again from SVN. >>> >>> -----Original Message----- >>> From: hib...@li... >>> [mailto:hib...@li...] On Behalf Of >>> Emmanuel Bernard >>> Sent: Sunday, June 18, 2006 10:21 PM >>> To: Hibernate development >>> Subject: [Hibernate] New error on Annotation query >>> >>> Has something changed that I haven't propagated in my code? >>> >>> >>> org.hibernate.HibernateException: cannot perform autodiscovery on >>> queries with non-scalar results >>> at >>> >>> =20 > org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. > =20 >>> performDiscovery(CustomLoader.java:453) >>> at >>> >>> =20 > org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. > =20 >>> java:511) >>> at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) >>> at org.hibernate.loader.Loader.doQuery(Loader.java:662) >>> at >>> >>> =20 > org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade > =20 >>> r.java:224) >>> at org.hibernate.loader.Loader.doList(Loader.java:2144) >>> at >>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) >>> at org.hibernate.loader.Loader.list(Loader.java:2023) >>> at >>> org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) >>> at >>> org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) >>> at >>> >>> =20 > org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 > =20 >>> ) >>> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) >>> at >>> >>> =20 > org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi > =20 >>> tePKAndComponents(QueryTest.java:195) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> >>> =20 > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > =20 >>> a:39) >>> at >>> >>> =20 > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > =20 >>> Impl.java:25) >>> at >>> =20 > org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) > =20 >>> at >>> >>> =20 > com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) > =20 >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> >>> =20 > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > =20 >>> a:39) >>> at >>> >>> =20 > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > =20 >>> Impl.java:25) >>> at >>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >>> >>> >>> >>> @NamedNativeQuery(name =3D "compositekey", >>> query =3D "select name, model, speed, lname as lastn, fname = as >>> firstn, length, width, length * width as surface, length * width *10 >>> =20 > as > =20 >>> volume from SpaceShip", >>> resultSetMapping =3D "compositekey") >>> } >>> >>> >>> @SqlResultSetMapping(name =3D "compositekey", >>> entities =3D @EntityResult(entityClass =3D >>> org.hibernate.test.annotations.query.SpaceShip.class, >>> fields =3D { >>> @FieldResult(name =3D "name", column =3D "name"), >>> @FieldResult(name =3D "model", column =3D "model"), >>> @FieldResult(name =3D "speed", column =3D "speed"), >>> @FieldResult(name =3D "dimensions.width", column =3D >>> "width"), >>> @FieldResult(name =3D "captain.lastname", column =3D >>> "lastn"), >>> @FieldResult(name =3D "dimensions.length", column = =3D >>> "length"), >>> @FieldResult(name =3D "captain.firstname", column = =3D >>> "firstn") >>> }), >>> columns =3D {@ColumnResult(name =3D "surface"), >>> @ColumnResult(name =3D "volume")}) >>> >>> >>> >>> _______________________________________________ >>> hibernate-devel mailing list >>> hib...@li... >>> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >>> >>> =20 >> All the advantages of Linux Managed Hosting--Without the Cost and >> =20 > Risk! > =20 >> Fully trained technicians. The highest number of Red Hat >> =20 > certifications =20 > =20 >> in >> the hosting industry. Fanatical Support. Click to learn more >> >> =20 > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat=3D= 121642 > =20 >> _______________________________________________ >> hibernate-devel mailing list >> hib...@li... >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >> =20 > > > > =20 |
From: Steve E. <ste...@jb...> - 2006-06-22 20:41:38
|
Actually, I just tested with HSQLDB. For me, HSQLDB is *also* returning columnType =3D 12 for both of those scalars (and Hibernate then returns Strings for both)... -----Original Message----- From: hib...@li... [mailto:hib...@li...] On Behalf Of Steve Ebersole Sent: Thursday, June 22, 2006 3:37 PM To: Hibernate development Subject: Re: [Hibernate] New error on Annotation query On Oracle10g it actually returns String for both of the scalars. Not sure what you want to have happen here. The ResultSetMetaData explicitly reports columnType =3D 12 (java.sql.Types.VARCHAR) for both = of these columns. It's not like I can return numerics for all columnType = =3D 12 auto-discoveries... -----Original Message----- From: Emmanuel Bernard [mailto:emm...@hi...]=20 Sent: Wednesday, June 21, 2006 4:59 PM To: Steve Ebersole Cc: Hibernate development Subject: Re: [Hibernate] New error on Annotation query My description was too generic. I've updated the GeneralTest by adding a SpaceShip class. It now fails with the error I encountered. Steve Ebersole wrote: > I just ran this on Oracle-10g and HSQLDB and both worked fine for me. > > On Oracle, the discovered types were BigDecimalType and BigDecimalType. > > On HSQLDB, the discovered types were BigIntegerType and BigDecimalType > > -----Original Message----- > From: hib...@li... > [mailto:hib...@li...] On Behalf Of > Steve Ebersole > Sent: Wednesday, June 21, 2006 3:55 PM > To: Max Andersen; Emmanuel Bernard > Cc: Hibernate development > Subject: Re: [Hibernate] New error on Annotation query > > I am creating a similar test in the core testsuite and see if I can > reproduce. > > -----Original Message----- > From: Max Andersen=20 > Sent: Wednesday, June 21, 2006 3:53 PM > To: Emmanuel Bernard; Steve Ebersole > Cc: Hibernate development > Subject: Re: [Hibernate] New error on Annotation query > > > This should be controlled by calls to Dialect.registerHibernateType() > and =20 > whatever the underlying db returns. > > This has not changed afaik. > > /max > > =20 >> The initial issue is fixed, >> But now I do have some weird type conversion using HSQLDB (didn't >> =20 > tried > =20 >> the other ones). >> >> basically I do have >> public Dimension() { >> private int length; >> private int width; >> } >> >> ints are converted into INTEGER types at the DB level, fine >> >> The following native SQL query, mapped using scalar autodiscovery >> select length * width as surface, length * width * 10 as volume ... >> >> returns String for the first argument and Double for the second >> The same query used to return BigInteger for the first one and >> BigDecimal for the second. >> >> >> >> Steve Ebersole wrote: >> =20 >>> Try it again from SVN. >>> >>> -----Original Message----- >>> From: hib...@li... >>> [mailto:hib...@li...] On Behalf Of >>> Emmanuel Bernard >>> Sent: Sunday, June 18, 2006 10:21 PM >>> To: Hibernate development >>> Subject: [Hibernate] New error on Annotation query >>> >>> Has something changed that I haven't propagated in my code? >>> >>> >>> org.hibernate.HibernateException: cannot perform autodiscovery on >>> queries with non-scalar results >>> at >>> >>> =20 > org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. > =20 >>> performDiscovery(CustomLoader.java:453) >>> at >>> >>> =20 > org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. > =20 >>> java:511) >>> at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) >>> at org.hibernate.loader.Loader.doQuery(Loader.java:662) >>> at >>> >>> =20 > org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade > =20 >>> r.java:224) >>> at org.hibernate.loader.Loader.doList(Loader.java:2144) >>> at >>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) >>> at org.hibernate.loader.Loader.list(Loader.java:2023) >>> at >>> org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) >>> at >>> org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) >>> at >>> >>> =20 > org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 > =20 >>> ) >>> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) >>> at >>> >>> =20 > org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi > =20 >>> tePKAndComponents(QueryTest.java:195) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> >>> =20 > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > =20 >>> a:39) >>> at >>> >>> =20 > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > =20 >>> Impl.java:25) >>> at >>> =20 > org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) > =20 >>> at >>> >>> =20 > com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) > =20 >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> >>> =20 > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > =20 >>> a:39) >>> at >>> >>> =20 > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > =20 >>> Impl.java:25) >>> at >>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >>> >>> >>> >>> @NamedNativeQuery(name =3D "compositekey", >>> query =3D "select name, model, speed, lname as lastn, fname = as >>> firstn, length, width, length * width as surface, length * width *10 >>> =20 > as > =20 >>> volume from SpaceShip", >>> resultSetMapping =3D "compositekey") >>> } >>> >>> >>> @SqlResultSetMapping(name =3D "compositekey", >>> entities =3D @EntityResult(entityClass =3D >>> org.hibernate.test.annotations.query.SpaceShip.class, >>> fields =3D { >>> @FieldResult(name =3D "name", column =3D "name"), >>> @FieldResult(name =3D "model", column =3D "model"), >>> @FieldResult(name =3D "speed", column =3D "speed"), >>> @FieldResult(name =3D "dimensions.width", column =3D >>> "width"), >>> @FieldResult(name =3D "captain.lastname", column =3D >>> "lastn"), >>> @FieldResult(name =3D "dimensions.length", column = =3D >>> "length"), >>> @FieldResult(name =3D "captain.firstname", column = =3D >>> "firstn") >>> }), >>> columns =3D {@ColumnResult(name =3D "surface"), >>> @ColumnResult(name =3D "volume")}) >>> >>> >>> >>> _______________________________________________ >>> hibernate-devel mailing list >>> hib...@li... >>> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >>> >>> =20 >> All the advantages of Linux Managed Hosting--Without the Cost and >> =20 > Risk! > =20 >> Fully trained technicians. The highest number of Red Hat >> =20 > certifications =20 > =20 >> in >> the hosting industry. Fanatical Support. Click to learn more >> >> =20 > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat=3D= 121642 > =20 >> _______________________________________________ >> hibernate-devel mailing list >> hib...@li... >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel >> =20 > > > > =20 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Max A. <max...@jb...> - 2006-06-19 18:40:14
|
>From my understanding in discussions with Max, auto-discovery is = illegal once any returns have been defined/added. Max, can you clarify here? Thinking some more about it, maybe you just meant the column name discovery (as it should be possible to still auto-discover types in this scenario)? Yes - autodiscover of scalar types should always be possible. name discovery is only possible activated when nothing is added to the = query. Also, in general, we need to make certain that these types of "integration point tests" are defined within the Hibernate test suite proper so that we can catch these discrepancies earlier... I dont have a working setup here at the moment - but there definitly = should be test for this part. But maybe this specific case of mixed add's might be missed. -max =20 -----Original Message----- From: hib...@li... [mailto:hib...@li...] On Behalf Of Emmanuel Bernard Sent: Sunday, June 18, 2006 10:21 PM To: Hibernate development Subject: [Hibernate] New error on Annotation query Has something changed that I haven't propagated in my code? org.hibernate.HibernateException: cannot perform autodiscovery on queries with non-scalar results at org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor. performDiscovery(CustomLoader.java:453) at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader. java:511) at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade r.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2144) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142 ) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) at org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndComposi tePKAndComponents(QueryTest.java:195) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) @NamedNativeQuery(name =3D "compositekey", query =3D "select name, model, speed, lname as lastn, fname as firstn, length, width, length * width as surface, length * width *10 as volume from SpaceShip", resultSetMapping =3D "compositekey") } @SqlResultSetMapping(name =3D "compositekey", entities =3D @EntityResult(entityClass =3D org.hibernate.test.annotations.query.SpaceShip.class, fields =3D { @FieldResult(name =3D "name", column =3D "name"), @FieldResult(name =3D "model", column =3D "model"), @FieldResult(name =3D "speed", column =3D "speed"), @FieldResult(name =3D "dimensions.width", column =3D "width"), @FieldResult(name =3D "captain.lastname", column =3D "lastn"), @FieldResult(name =3D "dimensions.length", column =3D "length"), @FieldResult(name =3D "captain.firstname", column =3D "firstn") }), columns =3D {@ColumnResult(name =3D "surface"), @ColumnResult(name =3D "volume")}) _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Max R. A. <max...@jb...> - 2006-06-20 12:22:00
|
I've just committed a test for the mixed setup. It passed before and fai= ls = now - for some reason the "addScalar" column name is not passed downward= s = to the autodiscovery ? /max >> From my understanding in discussions with Max, auto-discovery is ille= gal > once any returns have been defined/added. > > Max, can you clarify here? Thinking some more about it, maybe you jus= t > meant the column name discovery (as it should be possible to still > auto-discover types in this scenario)? > > Also, in general, we need to make certain that these types of > "integration point tests" are defined within the Hibernate test suite > proper so that we can catch these discrepancies earlier... > > -----Original Message----- > From: hib...@li... > [mailto:hib...@li...] On Behalf Of > Emmanuel Bernard > Sent: Sunday, June 18, 2006 10:21 PM > To: Hibernate development > Subject: [Hibernate] New error on Annotation query > > Has something changed that I haven't propagated in my code? > > > org.hibernate.HibernateException: cannot perform autodiscovery on > queries with non-scalar results > at > org.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcesso= r. > performDiscovery(CustomLoader.java:453) > at > org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoade= r. > java:511) > at org.hibernate.loader.Loader.getResultSet(Loader.java:1677) > at org.hibernate.loader.Loader.doQuery(Loader.java:662) > at > org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loa= de > r.java:224) > at org.hibernate.loader.Loader.doList(Loader.java:2144) > at > org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) > at org.hibernate.loader.Loader.list(Loader.java:2023) > at > org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) > at > org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) > at > org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:1= 42 > ) > at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) > at > org.hibernate.test.annotations.query.QueryTest.testNativeQueryAndCompo= si > tePKAndComponents(QueryTest.java:195) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j= av > a:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess= or > Impl.java:25) > at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:6= 7) > at > com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:3= 2) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j= av > a:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess= or > Impl.java:25) > at > com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) > > > > @NamedNativeQuery(name =3D "compositekey", > query =3D "select name, model, speed, lname as lastn, fname as= > firstn, length, width, length * width as surface, length * width *10 a= s > volume from SpaceShip", > resultSetMapping =3D "compositekey") > } > > > @SqlResultSetMapping(name =3D "compositekey", > entities =3D @EntityResult(entityClass =3D > org.hibernate.test.annotations.query.SpaceShip.class, > fields =3D { > @FieldResult(name =3D "name", column =3D "name"), > @FieldResult(name =3D "model", column =3D "model"), > @FieldResult(name =3D "speed", column =3D "speed"), > @FieldResult(name =3D "dimensions.width", column =3D > "width"), > @FieldResult(name =3D "captain.lastname", column =3D > "lastn"), > @FieldResult(name =3D "dimensions.length", column =3D > "length"), > @FieldResult(name =3D "captain.firstname", column =3D > "firstn") > }), > columns =3D {@ColumnResult(name =3D "surface"), > @ColumnResult(name =3D "volume")}) > > > > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel -- = -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate ma...@hi... http://hibernate.org JBoss Inc max...@jb... |