Re: [Hibernate] New error on Annotation query

2006-06-19 Thread Steve Ebersole
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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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 = [EMAIL PROTECTED](name = surface),
@ColumnResult(name = volume)})



___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


[Hibernate] Contributor for tools template

2006-06-19 Thread Christian Bauer
A Freemarker template for Hibernate Tools that can generate DBUnit  
ReplacementDataSet XML descriptors would probably be very useful to  
many people. Is there anybody interested in contributing such a thing?



___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Re: [Hibernate] New error on Annotation query

2006-06-19 Thread Max Andersen
Title: Re: [Hibernate] New error on Annotation query





From my understanding in discussions with Max, 
auto-discovery is illegalonce any returns have been 
defined/added.Max, can you clarify here? Thinking some more about 
it, maybe you justmeant the column name discovery (as it should be possible 
to stillauto-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 suiteproper 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

-Original Message-From: 
[EMAIL PROTECTED][mailto:[EMAIL PROTECTED]] 
On Behalf OfEmmanuel BernardSent: Sunday, June 18, 2006 10:21 PMTo: 
Hibernate developmentSubject: [Hibernate] New error on Annotation 
queryHas something changed that I haven't propagated in my 
code?org.hibernate.HibernateException: cannot perform autodiscovery 
onqueries with non-scalar results 
atorg.hibernate.loader.custom.CustomLoader$NonScalarResultColumnProcessor.performDiscovery(CustomLoader.java:453) 
atorg.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) 
atorg.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) 
at org.hibernate.loader.Loader.doList(Loader.java:2144) 
atorg.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) 
at org.hibernate.loader.Loader.list(Loader.java:2023) 
atorg.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:290) 
atorg.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) 
atorg.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) 
at 
org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) 
atorg.hibernate.test.annotations.query.QueryTest.testNativeQueryAndCompositePKAndComponents(QueryTest.java:195) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method) 
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at 
org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) 
atcom.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method) 
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
atcom.intellij.rt.execution.application.AppMain.main(AppMain.java:90)@NamedNativeQuery(name 
= "compositekey", query = "select 
name, model, speed, lname as lastn, fname asfirstn, length, width, length * 
width as surface, length * width *10 asvolume 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 = [EMAIL PROTECTED](name 
= "surface"), @ColumnResult(name = 
"volume")})___hibernate-devel 
mailing listhibernate-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/hibernate-devel___hibernate-devel 
mailing listhibernate-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/hibernate-devel


___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


[Hibernate] Hbm2Java and custom-type problem in Hibernate-3/Hib-tools:3.1.0.beta4

2006-06-19 Thread shalon toy
Greetings,
I am in the process of migrating my project code base to Hibernate-3
and having quite trouble with the way hibernate-tool in Hibernate3
work's with the CustomUserType's defined. The version of hibernate
being used is 3.1.3 and hibernate-tools is 3.1.0.beta4

Working version (old):
In Hibernate2, on invocation of hbm2java the following property in my *.hbm.xml
property column=LAST_MODIFIED length=11 name=lastModified
type=com.company.hibernate.usertypes.LastModifiedColumnType
meta attribute=use-in-tostringtrue/meta
meta attribute=default-valuenew java.util.Date()/meta
/property
gets converted to the following
/** nullable persistent field */
protected Date lastModified = new java.util.Date();
which was correct  all the interfaces with setters and getters were
written accordingly.
e.g: public void setLastModified(java.util.Date dt),
public Date getLastModified();

NEW:
In Hibernate-3, on invocation of the new hibernate-tool that wraps
hbm2java, the same snippet from *.hbm.xml results
 protected LastModifiedColumnType lastModified = new java.util.Date();
and hence all the code base breaks on the compile step coz =
found   : com.company.hibernate.usertypes.LastModifiedColumnType
required: java.util.Date

I have several other custom type's and I am not sure how this can be
fixed so that I can reuse my custom type(s). Is this a hibernate-tool
(hbm2java) bug in 3.1.0.beta-4 or is there a right way to accomplish
the same as in HIbernate-2.

Thanks for reading! Appreciate if any one can help.


___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel