-->
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.  [ 12 posts ] 
Author Message
 Post subject: middlegen generated mapping and source file problem
PostPosted: Wed Mar 03, 2004 1:29 pm 
Newbie

Joined: Tue Mar 02, 2004 10:56 pm
Posts: 12
I started this in another thread, but was recommended to create new thread- good idea...

here is problem - which i have subsequently solved - question is, why is the meta attribute element within composite-id element not legal, and if it is, why is it not loading the mapping?

The middlegen hbm mapping generation task creates a <meta attribute> element within the <composite-id> element. This does not appear to be legal. i believe i am using hte latest middlegen and i know i am using the 2.0 hibernate dtd from sourceforge - the top of the stack trace relevant to this error is:

2004-03-03 09:13:18,988 ERROR [TP-Processor2] cfg.Configuration (Configuration.java:276) - Could not configure datastore from
input stream
java.lang.NullPointerException
at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:239)
at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:734)


and in next stack it says:

2004-03-03 09:13:19,039 ERROR [TP-Processor2] cfg.Configuration (Configuration.java:248) - Could not compile the mapping docu
ment
net.sf.hibernate.MappingException: duplicate import: Eventgiftbundle

i am not sure what the exact issue is, but if i remove the meta attribtue tag, it goes away - ie, the class loads.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 1:55 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
can you post to JIRA a simple testcase showing that. The meta attribute is supposed to be allowed.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 2:34 pm 
Newbie

Joined: Tue Mar 02, 2004 10:56 pm
Posts: 12
jira? can you please give url or expl? i would love to help and resolve this. here is my composite-id element with the meta attribute - maybe there is something wrong with the meta-attribute?

Code:
    <composite-id name="comp_id" class="com.lupinex.pate.db.EventgiftbundleelementPK">
        <meta attribute="class-description" inherit="false">
           @hibernate.id
            generator-class="assigned"
        </meta>
        <!-- bi-directional many-to-one association to Giftelement -->
        <key-many-to-one
                name="giftelement"
                class="com.lupinex.pate.db.Giftelement"
            >
            <meta attribute="field-description">
               @hibernate.many-to-one
                column="giftelementid""
            </meta>
            <column name="giftelementid" />
            </key-many-to-one>
        <!-- bi-directional many-to-one association to Event -->
        <key-many-to-one
                name="event"
                class="com.lupinex.pate.db.Event"
            >
            <meta attribute="field-description">
               @hibernate.many-to-one
                column="eventid""
            </meta>
            <column name="eventid" />
            </key-many-to-one>
        <!-- bi-directional many-to-one association to Giftbundle -->
        <key-many-to-one
                name="giftbundle"
                class="com.lupinex.pate.db.Giftbundle"
            >
            <meta attribute="field-description">
               @hibernate.many-to-one
                column="giftbundleid""
            </meta>
            <column name="giftbundleid" />
            </key-many-to-one>
    </composite-id>

if i remove the first meta attribute element (the one for composite-id) the mapping loader continues - if i leave it, it throws the error i mention.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 2:44 pm 
Newbie

Joined: Tue Mar 02, 2004 10:56 pm
Posts: 12
I found jira - i will hold off as i am sure this is user error somehow - though if you see nothing wrong with my composite-id declaration, then i will try to work up a simple test case - what would be involved in a test case: a java class, the mapping file, and ??

thank you


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 3:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
What are you doing there, what are all these @ things? This is not a legal mapping file, please look at some tutorials and examples.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 3:05 pm 
Newbie

Joined: Tue Mar 02, 2004 10:56 pm
Posts: 12
okay - this was all generated for me by middlegen. i don't mean to waste anyone's time, so, i will just remove the meta tags. all the existing tutorials are for trivial examples and none that i can find use the exact primarykey paradigm that was setup for me by middlegen. middlegen decided to create a PK class for me and created this mapping.

i will say that hte META tags inside the key-many-to-one and property elements are not a problem - so, i would not know that those in the composite-id element are.

i will remove for now, just looking for ideas. i have read a lot about this, read about the auto-import flag in the mapping element and other possible solutions, but no one discusses this problem i have with the middlegen-generated element.

thanks for your input.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 3:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Oh sorry, I did not look close enought, in fact this should be legal ... Could you post a more complete stacktrace? You are using Hibernate 2.1.2 ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 4:31 pm 
Newbie

Joined: Tue Mar 02, 2004 10:56 pm
Posts: 12
stack trace starting when it tries to parse(?) the Eventgiftbundleelement mapping file - as an aside, these debug message are based on log4j settings - which file am i to edit to change the 'level' of information?

as i have said, if i remove the single META element from composite-id, this error does not happen - as you can see, this also stops the entire processing - i have 10 other hbm files to process after this one - and if i remove the META tag it continues processing, until it hits another class that has a META tag in a composite-id

2004-03-03 09:31:50,426 DEBUG [TP-Processor3] cfg.Configuration (Configuration.java:933) - null<-org.dom4
j.tree.DefaultAttribute@1071521 [Attribute: name resource value "com/lupinex/pate/db/Eventgiftbundleelement.h
bm.xml"]
2004-03-03 09:31:50,428 INFO [TP-Processor3] cfg.Configuration (Configuration.java:287) - Mapping resour
ce: com/lupinex/pate/db/Eventgiftbundleelement.hbm.xml
2004-03-03 09:31:50,461 DEBUG [TP-Processor3] util.DTDEntityResolver (DTDEntityResolver.java:20) - trying
to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
2004-03-03 09:31:50,463 DEBUG [TP-Processor3] util.DTDEntityResolver (DTDEntityResolver.java:29) - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
2004-03-03 09:31:50,481 INFO [TP-Processor3] cfg.Binder ( Binder.java:196) - Mapping class: com.
lupinex.pate.db.Eventgiftbundleelement -> eventgiftbundleelement
2004-03-03 09:31:50,494 ERROR [TP-Processor3] cfg.Configuration (Configuration.java:276) - Could not conf
igure datastore from input stream
java.lang.NullPointerException
at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:239)
at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:734)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:263)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1173)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:245)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:268)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:291)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:935)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:890)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:826)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:812)
at com.lupinex.pate.util.PateSessionFactory.currentSession(PateSessionFactory.java:20)
at com.lupinex.pate.db.PersonFactory.<init>(PersonFactory.java:29)
at com.lupinex.pate.action.authentAction.isAuthenticated(authentAction.java:36)
at com.lupinex.pate.action.authentAction.execute(authentAction.java:64)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:509)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:324)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:395)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
2004-03-03 09:31:50,509 INFO [TP-Processor3] cfg.Configuration (Configuration.java:287) - Mapping resour
ce: com/lupinex/pate/db/Eventgiftbundleelement.hbm.xml
2004-03-03 09:31:50,524 DEBUG [TP-Processor3] util.DTDEntityResolver (DTDEntityResolver.java:20) - trying
to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
2004-03-03 09:31:50,526 DEBUG [TP-Processor3] util.DTDEntityResolver (DTDEntityResolver.java:29) - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
2004-03-03 09:31:50,559 ERROR [TP-Processor3] cfg.Configuration (Configuration.java:248) - Could not comp
ile the mapping document
net.sf.hibernate.MappingException: duplicate import: Eventgiftbundleelement
at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:68)
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:117)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:183)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1173)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:245)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:268)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:291)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:938)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:890)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:826)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:812)
at com.lupinex.pate.util.PateSessionFactory.currentSession(PateSessionFactory.java:20)
at com.lupinex.pate.db.PersonFactory.<init>(PersonFactory.java:29)
at com.lupinex.pate.action.authentAction.isAuthenticated(authentAction.java:36)
at com.lupinex.pate.action.authentAction.execute(authentAction.java:64)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:509)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:324)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:395)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
2004-03-03 09:31:50,572 ERROR [TP-Processor3] db.PersonFactory (PersonFactory.java:31) - Failed to get t
he current session from com.lupinex.pate.db.PersonFactory


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 4:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I think you are using an old version, this should be fixed in 2.1.2


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 4:57 pm 
Newbie

Joined: Tue Mar 02, 2004 10:56 pm
Posts: 12
thank you - i thought i downloaded the most recent. i guess not.

is there a way to determine a version from a jar - is it in a META-INF file or something?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 5:21 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
either the version at the end of the .zip distribution file or in the hibernate log when Hibernate initialize itself.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 7:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
This is fine - but you need later version of hibernate as the DTD has had a number of changes over its beta period (still called 2.0 for backward compatibility).


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