-->
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.  [ 2 posts ] 
Author Message
 Post subject: AnyBody have already used idBag?
PostPosted: Mon Nov 07, 2005 9:53 am 
Newbie

Joined: Tue Nov 01, 2005 6:38 am
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.0

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

[hibernatedoclet] C:\Projetos\framework-ANP\HibernateLocal.xml:58: XDoclet failed.
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:471)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:385)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:136)
[hibernatedoclet] Caused by: xdoclet.XDocletException: Class br.muralha.MenuPai misses ID property
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.hasCompositeId_Impl(HibernateTagsHandler.java:668)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.ifHasPrimitiveId(HibernateTagsHandler.java:211)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[hibernatedoclet] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[hibernatedoclet] at java.lang.reflect.Method.invoke(Unknown Source)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invoke(TemplateEngine.java:641)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:567)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:965)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:932)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:472)
[hibernatedoclet] at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:348)
[hibernatedoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:415)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:562)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:779)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:679)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:596)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:227)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
[hibernatedoclet] ... 8 more
[hibernatedoclet] --- Nested Exception ---
[hibernatedoclet] xdoclet.XDocletException: Class br.muralha.MenuPai misses ID property
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.hasCompositeId_Impl(HibernateTagsHandler.java:668)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.ifHasPrimitiveId(HibernateTagsHandler.java:211)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[hibernatedoclet] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[hibernatedoclet] at java.lang.reflect.Method.invoke(Unknown Source)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invoke(TemplateEngine.java:641)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:567)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:965)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:932)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:472)
[hibernatedoclet] at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:348)
[hibernatedoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:415)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:562)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:779)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:679)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:596)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:227)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:385)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:136)
BUILD FAILED: C:\Projetos\framework-ANP\HibernateLocal.xml:58: Unexpected error

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


I'm trying to use idbag, but i can't. The code is below:
/**
* @hibernate.idbag table="menu" lazy="true"
* @hibernate.collection-id type="long" column="idMenu"
* @hibernate.generator-param name="sequence" value="IdMenu"
* @hibernate.collection-key column="IDmenuPai"
* @hibernate.collection-element type="string" column="nomefisico" not-null="true"
*/

I don't understand what happened. Anybody Help me?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 07, 2005 6:33 pm 
Newbie

Joined: Mon Nov 07, 2005 6:11 pm
Posts: 6
I am using it with good results. I have a many-to-many relationship between a ProductRevision table and a Risk table. The association table has three columns: prod_risk_id, prod_rev_id, risk_id. prod_risk_id is an unnecessary primary key I am using because I don't like multi-column pk values. Here is my mapping for the association table:

Code:
   <idbag name="risks" table="hmmtb_product_risk">
       <collection-id column="prod_risk_id" type="int">
          <generator class="edu.mayo.gensupp.hmm.util.GSFMultipleHiLoPerTableGenerator">
              <param name="table">hmmtb_next_id</param>
              <param name="primary_key_column">nxt_pk_col</param>
              <param name="value_column">nxt_pk_value</param>
              <param name="primary_key_value">prod_risk_id</param>
              <param name="primary_key_length">30</param>
          </generator>
       </collection-id>
       <key column="prod_rev_id"/>
       <!-- mapped with outer join tag because hibernate docs example had it -->
       <many-to-many column="risk_id" class="Risk" outer-join="true"/>
   </idbag>


This is in the ProductRevision mapping file.

jh


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