-->
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.  [ 9 posts ] 
Author Message
 Post subject: Problem loading hbm files generated with Middlegen
PostPosted: Mon Jul 12, 2004 3:54 pm 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
Hello,
I am using Hibernate 2.1.4, Oracle9i and the Middlegen plugin bundle from sourceforge. First time using Middlegen, pretty cool tool. It generated the source from what I can tell correctly. However, when I try to load the .hbm.xml files I receive the following error

Code:
13:31:20,752  INFO Binder:229 - Mapping class: sh.hibernate.Document -> DOCUMENT
13:31:20,783  INFO Configuration:185 - Mapping file: c:\projects\hub\target\classes\sh\hibernate\Documentauthor.hbm.xml
13:31:20,799  INFO Binder:229 - Mapping class: sh.hibernate.Documentauthor -> DOCUMENTAUTHOR
13:31:20,893  INFO ReflectHelper:176 - reflection optimizer disabled for: sh.hibernate.DocumentauthorPK, IllegalAccessError: null
java.lang.IllegalAccessError
   at net.sf.cglib.core.ClassEmitter.setTarget(ClassEmitter.java:85)
   at net.sf.cglib.core.ClassEmitter.<init>(ClassEmitter.java:77)
   at net.sf.cglib.reflect.FastClassEmitter.<init>(FastClassEmitter.java:91)
   at net.sf.cglib.reflect.FastClass$Generator.generateClass(FastClass.java:100)
   at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:63)
   at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:192)
   at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:92)
   at net.sf.cglib.reflect.FastClass.create(FastClass.java:74)
   at net.sf.hibernate.type.ComponentType.<init>(ComponentType.java:113)
   at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:899)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:287)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1243)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285)
   at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:187)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:421)
   at sh.util.HibernateUtil.<init>(HibernateUtil.java:64)
   at sh.util.HibernateUtil.<clinit>(HibernateUtil.java:30)
   at sh.dao.KeyDao.<init>(KeyDao.java:28)
   at sh.cmd.QueryCommand.queryKey(QueryCommand.java:123)
   at sh.cmd.QueryCommand.execute(QueryCommand.java:57)
   at sh.cmd.CommandManager.invokeCommand(CommandManager.java:36)
   at sh.cmd.QueryCommand.<init>(QueryCommand.java:46)
   at sh.cmd.CommandFactory.execute(CommandFactory.java:45)
   at sh.HubMain.main(HubMain.java:44)
Exception in thread "main"

According to the doc I am suppose to let middlegen create the PK classes

Code:
<!-- Plugins - Only Hibernate Plugin has been included with this special distribution  -->
         
         <!--
         If you want to generate XDoclet markup for hbm2java to include in the POJOs then
         set genXDocletTags to true. Also, composite keys are generated as external classes which is
         recommended. If you wish to keep them internal then set genIntergratedCompositeKeys to true.
         Since r4 the ability to customise the selection of JavaTypes is now provided. The is a
         recommended type mapper provided as shown. It is optional - if not provided then Middlegen
         itself will select the Java mapping (as it did previously).
         These settings are optional thus if they are not define here values default to false.
         -->
         <hibernate
            destination="${classes.dir}"
            package="com.bofa.ciportal.sh.hibernate"
            genXDocletTags="true"
            genIntergratedCompositeKeys="false"
            javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
         />


I have tried to run it with compositeKeys=true and get the same error.

There is no *.hbm.xml file that is generated for the DocumentauthorPK class. I do not understand why this is happening. Can anyone point me in the right direction?



---Jason


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 12, 2004 8:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Middlegen creates the mapping docs then hbm2java is to be used to create the Java source. This includes the generation fo the composite keys based on the mapping document. Not sure whats up with the access exception. I do know that the lastest hbm2java will not create the equals and hashcode without the new markup to guide it (It used to create them as a best guess on which fields were approrpriate). This maybe the issue so make sure you have them as they are required for composite key usage.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 13, 2004 11:17 am 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
i understand what you are saying. i want to set it in the codegen section, but where do I specify the hbm2java.xml for the codegen at?

---Jason


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 13, 2004 11:19 am 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
never mind, i found it...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 13, 2004 11:29 am 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
but according to the hbm2java docs, i need to set a META tag for the equal-hash. which means this needs to be done in middlegen correct?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 7:51 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Yes - This is an item I have been meaning to add to the code. This is the reason that R5 has not been released yet. For the moment, you can choose to use an older version of hbm2java which has not introduced the new tags.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 9:33 pm 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
i just hand coded it.
can you notify me when you release RC5 please

thanks for the help.


---Jason


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 9:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I'll see if I can get off my but and get it done this weekend.
It will be announced and possibly included in the news section.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 18, 2004 6:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The changes are in CVS. Couldn't complete testing and packing on Sunday so sometime this week I'll release it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.