-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Hibernate Code Generation failed with collection-type=...
PostPosted: Sun Dec 24, 2006 7:37 am 
Newbie

Joined: Sun Dec 24, 2006 6:37 am
Posts: 2
Eclipse - Version: 3.2.1 Build id: M20060921-0945
Hibernate Tools - Version 3.2.0beta8
Hibernate Version - where can i find it?
glazed-lists - Version 1.7.1.alpha20061218

I am a hibernate newbie.
Managed to run the "Hibernate Code Generation" tool within eclipse,
to generate java-Files.
I just wanted to try the new extension provided by the upcoming glazed-lists-version,

So I used
collection-type="ca.odell.glazedlists.hibernate.EventListType"
for one list in my .hbm.xml-file
and got the following error-message when running the code generation

Quote:
org.hibernate.tool.hbm2x.ExporterException: Error while processing template pojo/Pojo.ftl
freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(org.hibernate.mapping.Property,boolean) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(tst.glazedhibernatetst.data.ExampleTypeA)
freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(org.hibernate.mapping.Property,boolean) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(tst.glazedhibernatetst.data.ExampleTypeA)
org.hibernate.tool.hbm2x.ExporterException: Could not resolve type without exception for org.hibernate.mapping.Property(adressen) Value: org.hibernate.mapping.List(tst.glazedhibernatetst.data.ExampleTypeA.adressen)
org.hibernate.MappingException: user colllection type class not found: ca.odell.glazedlists.hibernate.EventListType
java.lang.ClassNotFoundException: ca.odell.glazedlists.hibernate.EventListType


This was easy to solve.
I specified the glazed-list-jar-file in the classpath-table within the console configuration
and I got the followin error-message:

Quote:
org.hibernate.tool.hbm2x.ExporterException: Error while processing template pojo/Pojo.ftl
freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(org.hibernate.mapping.Property,boolean) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(tst.glazedhibernatetst.data.ExampleTypeA)
freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(org.hibernate.mapping.Property,boolean) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(tst.glazedhibernatetst.data.ExampleTypeA)
java.lang.reflect.InvocationTargetException: <no message>
java.lang.AbstractMethodError: ca.odell.glazedlists.hibernate.EventListType.instantiate(I)Ljava/lang/Object;

Should I post the used version of EventListTypeTest.java here?
Never used collection-type before. Is this problem related to the unstable state of galzed-lists or is ist my fault?
Has anybody else experienced the same problem?

Thank you :D


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 24, 2006 10:52 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
never used that usertype, but as far as i can see it tries to instantiate or use an abstract class which probably is caused by some version incompability between that usertype and hibernate or glazedlist.

Try and compile the source against the version of glazedlist and hibernate you use.

btw. I thought a glazedlist was more a ui thing than it was a model thing ? why the need to persist it via hibernate ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 26, 2006 4:54 am 
Newbie

Joined: Sun Dec 24, 2006 6:37 am
Posts: 2
Quote:
btw. I thought a glazedlist was more a ui thing than it was a model thing ?

You are right. But glazedlists is based on its interface EventList which adds some methods to the List interface to allow locking and fine graded change notification. This fine graded change notification allows to handle transformations (filtering, sorting, ...) more efficiently.

Quote:
why the need to persist it via hibernate ?

You do not persist glazedlist-stuff. You persist your data. And since glazedlist does not work with a plain PersistentList you have to put the data into an EventList. The new galzedlists.hibernate-package tries to provide a PersistentEventList which extends hibernate's PersistentList implements glazedlists' EventList. Using collection-type=EventListType hibernate is told to use PersistentEventList. So hibernate put's data into an List which can be directly used with glazedlists.

Don't you think that there are applications where such an direct coupling makes sense?

1. There are some folks who use hibernate within their swing application.
2. There is also some network-related stuff in the glazedlists.io-package (haven't looked into it so far). So there may be cases where it makes sense to use glazedlist within the server code. I think this can be an easy way to implement an immediate-change-notification.

max wrote:
never used that usertype, but as far as i can see it tries to instantiate or use an abstract class which probably is caused by some version incompability between that usertype and hibernate or glazedlist.

Try and compile the source against the version of glazedlist and hibernate you use.


accurate diagnosis, max. :-) The problem was caused by the following hibernate-glazedlists incompatibility:
https://glazedlists.dev.java.net/issues ... cgi?id=387

Thank you for the hint.

At the moment there is no stable release of glazedlists' hibernate package. But publicobject has planned this feature for the next galzedlists release. More about the topic can be found in the glazedlists wiki:

http://publicobject.com/glazedlists/wik ... =Hibernate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 27, 2006 5:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ok - good to see the UserCollectionType being put to good use.

and yes, I can see its usage; it's just that sometime users persists things they shouldn't so just wanted to be sure ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.