-->
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.  [ 6 posts ] 
Author Message
 Post subject: Not allows to assign primary key during reverse engineering
PostPosted: Wed Jan 24, 2007 10:15 am 
Newbie

Joined: Wed Jan 24, 2007 9:24 am
Posts: 3
Hi,

I want to assign a primary key while generating the pojo using hibernate.reveng.xml file by the ant tool.

My hibernate.reveng.xml file looks like this:
----------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<table-filter match-name="VW_.*" exclude="false"/>
<table-filter match-name=".*" exclude="true"/>
<table catalog="TD20_QA2_Master_443" schema="trd0nedbo" name="VW_UI_PROMO_PLAN_PROD_LOCATION">
<primary-key>
<key-column name="plan_id"/>
</primary-key>
<column name="LOCATION_ID" jdbc-type="0" property="locationID"/>
<column name="primary_DC_name" jdbc-type="1" property="primaryDCName"/>
</table>
</hibernate-reverse-engineering>
-----------------------------------------------------
I tried to generate pojo's using
ant -verbose gen

It is throwing error like:

.....
....
org.xml.sax.saxparseexception: Element type "primary-key" must be declared.
......
.......
I don't know why? Even I checked it in the DTD, the element "primary-key" exists.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 24, 2007 12:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
show the full stacktrace...should just work.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 2:08 am 
Newbie

Joined: Wed Jan 24, 2007 9:24 am
Posts: 3
This is that I get when try to generate pojo's using ant.

E:\TrueDemand_USA\tools\hibernate-tools-sqlsvr>ant -verbose gen
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.5.
0_08\lib\tools.jar
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\Program Files\Java\jre1.5.0_08
Detected OS: Windows XP
parsing buildfile E:\TrueDemand_USA\tools\hibernate-tools-sqlsvr\build.xml with
URI = file:///E:/TrueDemand_USA/tools/hibernate-tools-sqlsvr/build.xml
Project base dir set to: E:\TrueDemand_USA\tools\hibernate-tools-sqlsvr
[property] Loading E:\TrueDemand_USA\tools\hibernate-tools-sqlsvr\build.propert
ies
Build sequence for target(s) `gen' is [gen]
Complete build sequence is [gen, build, package, clean, build2, package2, usage,
]

gen:
[mkdir] Created dir: C:\tdemand\hibernate-gen\gen
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse
engineering)
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.hibernate
.cfg.Environment).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.

BUILD FAILED
E:\TrueDemand_USA\tools\hibernate-tools-sqlsvr\build.xml:41: org.hibernate.Mappi
ngException: Could not configure overrides from file: E:\TrueDemand_USA\tools\hi
bernate-tools-sqlsvr\hibernate.reveng.xml
at org.apache.tools.ant.Task.perform(Task.java:373)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: org.hibernate.MappingException: Could not configure overrides from fi
le: E:\TrueDemand_USA\tools\hibernate-tools-sqlsvr\hibernate.reveng.xml
at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepositor
y.java:61)
at org.hibernate.tool.ant.JDBCConfigurationTask.doConfiguration(JDBCConf
igurationTask.java:61)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(Configurati
onTask.java:50)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateTo
olTask.java:158)
at org.hibernate.tool.ant.GeneratorTask.configureExporter(GeneratorTask.
java:73)
at org.hibernate.tool.ant.Hbm2JavaGeneratorTask.configureExporter(Hbm2Ja
vaGeneratorTask.java:37)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:31)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:122)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
... 10 more
Caused by: org.hibernate.MappingException: invalid override definition
at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRe
pository.java:90)
at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepositor
y.java:57)
... 19 more
Caused by: org.xml.sax.SAXParseException: Element type "primary-key" must be dec
lared.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Sourc
e)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRe
pository.java:89)
... 20 more
--- Nested Exception ---
org.hibernate.MappingException: Could not configure overrides from file: E:\True
Demand_USA\tools\hibernate-tools-sqlsvr\hibernate.reveng.xml
at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepositor
y.java:61)
at org.hibernate.tool.ant.JDBCConfigurationTask.doConfiguration(JDBCConf
igurationTask.java:61)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(Configurati
onTask.java:50)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateTo
olTask.java:158)
at org.hibernate.tool.ant.GeneratorTask.configureExporter(GeneratorTask.
java:73)
at org.hibernate.tool.ant.Hbm2JavaGeneratorTask.configureExporter(Hbm2Ja
vaGeneratorTask.java:37)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:31)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:122)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: org.hibernate.MappingException: invalid override definition
at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRe
pository.java:90)
at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepositor
y.java:57)
... 19 more
Caused by: org.xml.sax.SAXParseException: Element type "primary-key" must be dec
lared.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Sourc
e)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRe
pository.java:89)
... 20 more

Total time: 1 second
E:\TrueDemand_USA\tools\hibernate-tools-sqlsvr>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 6:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what version of the tools are you running with ?

did you try and verify the xml with a xml verifier to see more precisly why the xml parser thinks you have a non well formed xml ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 9:31 am 
Newbie

Joined: Wed Jan 24, 2007 9:24 am
Posts: 3
Ya, I have verified with xml verifier(xml shell), it tells that the xml file is valid and well formed.

The versions of the tools are
Hibernate Version: 3.0
Ant Version: 1.6.5


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 10:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the version number im interested in is the version of hibernate tools...

_________________
Max
Don't forget to rate


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