- This topic has 6 replies, 3 voices, and was last updated 18 years, 10 months ago by
deez0n.
-
AuthorPosts
-
Jim AnconaMemberI’m running MYE 4.1 GA installed from scratch. When I attempt to validate the Hibernate mapping file at the end of this post, I get this error at line 10:
Attribute “generated” must be declared for element type “property”.
Checking further it appears that the DTD in MyEclipse4.1\eclipse\plugins\com.ibm.webtooling.system.dtds_14.1.0\dtds does not match the official one at http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd. It appears to be missing a number of features including the “generated” attribute that is causing the error in my test case.
Thanks,
Jim Ancona
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="test"> <class name="Test" table="TEST"> <id name="id" type="integer" unsaved-value="0"> <column name="ID"/> <generator class="identity"/> </id> <property name="lastUpdateTime" type="timestamp" generated="always"> <column name="LAST_UPDATE_TIME" length="26" not-null="true" /> </property> </class> </hibernate-mapping>
Riyad KallaMemberJim,
I confirmed this, we’ll take a look, sorry for the trouble.
Jim AnconaMemberThanks for the quick response. The workaround I found is to modify the doctype from:
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
to
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
Evidently this forces the validator to look on the internet for the DTD, rather than retrieving the incorrect version from MyEclipse’s built-in catalog. I’m hoping it doesn’t encourage Hibernate to do the same at runtime, rather than retrieving it from its jar file. 8)
Jim
Riyad KallaMemberJim,
Thank you for the workaround, we have a developer that is refreshing *all* of the hibernate DTDs today in the code base, this should be in 4.1.1
Jim AnconaMemberI investigated further and found that MyEclipse has the DTD that was shipped with Hibernate 3.0. Evidently, when Hibernate 3.1 shipped, they updated the DTD without giving it a new name. So http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd is actually the Hibernate 3.1 DTD!
I am using Hibernate 3.1 for my project, so I’m not using the Hibernate library shipped with MyEclipse. But since MYE is retrieving the DTD from its own catalog (a reasonable behavior, given that the PUBLIC identifier didn’t change), my mapping XML shows an error.
So, arguably the real problem is Hibernate changing their DTD without changing its identifier.
Jim
Riyad KallaMemberI investigated further and found that MyEclipse has the DTD that was shipped with Hibernate 3.0. Evidently, when Hibernate 3.1 shipped, they updated the DTD without giving it a new name. So http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd is actually the Hibernate 3.1 DTD!
Aye, this is what we found as well. Frustrating.
I am using Hibernate 3.1 for my project, so I’m not using the Hibernate library shipped with MyEclipse. But since MYE is retrieving the DTD from its own catalog (a reasonable behavior, given that the PUBLIC identifier didn’t change), my mapping XML shows an error.
I can’t think of a great workaround for this right now because the plugin-contributed entries in the XML catalog are fixed and cannot be removed or modified. You could try and enter a user entry and see if the resolver checked user entries first instead of the local system entries.
deez0nMemberFound this post in a google search, someone else may come across.
This may not be the best solution but I’m behind a corporate proxy and this made my life easier
My solution was to download the current dtd from
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtdand save it to the
[MyEclipse 4.1_HOME]/eclipse/plugins/com.ibm.webtooling.system.dtds_14.1.1/dtds/replacing the one that is there… this fixes the auto completes for attributes such as lazy=”true” (old default, and does not work anymore) to lazy=”false” (new default) as well as shows the options of proxy and no-proxy which are new for hibernate 3.1
Good luck
ds -
AuthorPosts