-
1. Re: How to generate annotated Java classes from hbm.xml file
maxandersen Jan 27, 2008 3:57 AM (in response to baz)so you are probably using some specific construct in hbm.xml that the annotations generation does not support yet. If you can figure out which hbm.xml or set of hbm.xml's that is causing the issue put them in jira and we can look at what is the problem.
-
2. Re: How to generate annotated Java classes from hbm.xml file
baz Jan 27, 2008 8:24 AM (in response to baz)Thanks for the response.
Meanwhile i have detected that code IS generated. Due to the error there is no refresh of the directory list inside eclipse. A simple refresh revealed the generated code.
All classes are there. But due to the error a many2one dependenxy must be missing. I will investigate further and compare the genereted Code with my expectations.
Some questions?
Is code generated class by class?
Or it is generated in turns,e.g.: first all the java code for all classes, then table annotations for all classes, then dependencys ...
I am asking because i am missing named querys which are present in the hbm.xml but not in the generated code.
Perhaps the error occurs when these querys are parsed.
Ciao,
Carsten -
3. Re: How to generate annotated Java classes from hbm.xml file
maxandersen Jan 27, 2008 9:22 AM (in response to baz)They are generated per class.
Im not sure named queries are generated by the annotation support... -
4. Re: How to generate annotated Java classes from hbm.xml file
baz Jan 29, 2008 2:50 AM (in response to baz)Hello,
Thanks for the answer.
I am now trying to assemble a short example wich shows the problematic code. I am not quite sure that i found it already. But a one2one association is not correctly generated so that the generated code gives a compiler error. If i am ready i submit it to jira with reference to this thread. -
5. Re: How to generate annotated Java classes from hbm.xml file
baz Feb 9, 2008 9:41 AM (in response to baz)I have created this JIRA issue: http://jira.jboss.com/jira/browse/JBIDE-1767
-
6. Re: How to generate annotated Java classes from hbm.xml file
baz Feb 9, 2008 9:45 AM (in response to baz)When igenerate source code with the mapping files in the JIRA issue no exception is thrown. It only generates faulty code. So the exception must come from another part of the code:-( I will investigate this further.
-
7. Re: How to generate annotated Java classes from hbm.xml file
baz Feb 10, 2008 5:05 AM (in response to baz)Finally i found it.
This mapping causes the exception:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="demo"> <class name="Sample2Well" table="sample2well" optimistic-lock="none"> <id name="id" type="long" unsaved-value="null" column="SAMPLE2WELLID"> <generator class="native"/> </id> <property name="analysisIndex" type="integer" column="analysisindex"/> <bag name="sampleWell" lazy="false" table="samplewell" cascade="save-update"> <key foreign-key="sampleWell_id" column="SAMPLE2WELLID"/> <composite-element class="demo.SampleWellType"> <many-to-one name="sample" entity-name="demo.Sample" foreign-key="Sample_id" not-null="false" column="SAMPLEID" cascade="none"/> <nested-composite-element name="well" class="demo.Well"> <property name="adress" type="string" column="well_adress"/> <property name="column" type="short" column="well_column"/> <property name="row" type="character" column="well_row" length="1"/> </nested-composite-element> </composite-element> </bag> </class> </hibernate-mapping> <hibernate-mapping package="demo"> <class name="Sample" table="sample" optimistic-lock="none"> <meta attribute="class-description" inherit="false">@hibernate.class table="sample"</meta> <id name="id" type="long" unsaved-value="null" column="SAMPLEID"> <generator class="native"/> </id> <version name="version" column="version"/> <property name="sampleCode" type="string" column="sample_code"/> </class> </hibernate-mapping>
I have created this second jira issue:
http://jira.jboss.com/jira/browse/JBIDE-1768