-->
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.  [ 3 posts ] 
Author Message
 Post subject: Element "composite-element" does not allow "p
PostPosted: Sun Sep 12, 2004 10:11 am 
Newbie

Joined: Sun Sep 12, 2004 9:41 am
Posts: 3
I am newbie to hibernate . I download adminapp from http://www.hibernate.org/Documentation/ ... umentation , and add SchemaExportTask to build.xml to get ddl with successful result.
But when i change the <parent name="user"/> behind <property name="timeOfCreation" column="TIME_OF_CREATION"/> ,
like this:

<idbag name="userRoles"
lazy="true"
table="USER_ROLE"
order-by="TIME_OF_CREATION asc"
cascade="save-update">
<!-- the surrogate primary key -->
<collection-id column="USER_ROLE_ID"
type="long">
<generator class="increment"/>
</collection-id>
<!-- the foreign key of the User -->
<key column="USER_ID"/>
<!-- a composite-element holding the
associated Role and User, and the
creation time of the link -->
<composite-element class="UserRole">
<!-- an "extra" column -->
<property name="timeOfCreation" column="TIME_OF_CREATION"/>
<!-- for convenience, a backpointer
to the User -->
<parent name="user"/>
<!-- the foreign key of the Role -->
<many-to-one name="role"
cascade="save-update"
outer-join="false"
column="ROLE_ID"/>
<!-- since Roles are cached, disable
outerjoining! -->
</composite-element>
</idbag>

SchemaExportTask failed with infomation

[schemaexport] 21:26:55,000 INFO Environment:432 - Hibernate 2.1.1
[schemaexport] 21:26:55,031 INFO Environment:466 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.hsqldb.jdbcDriver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=sa, hibernate.hbm2ddl.auto=create, hibernate.connection.url=jdbc:hsqldb:hsql://localhost, hibernate.show_sql=true, hibernate.connection.password=, hibernate.connection.pool_size=5}
[schemaexport] 21:26:55,062 INFO Environment:480 - using java.io streams to persist binary types
[schemaexport] 21:26:55,062 INFO Environment:481 - using CGLIB reflection optimizer
[schemaexport] 21:26:55,156 INFO Configuration:166 - Mapping file: D:\jws\app\adminapp-0.9.2\adminapp-0.9.2\src\java\org\hibernate\admin\model\Role.hbm.xml
[schemaexport] 21:26:56,046 INFO Binder:225 - Mapping class: org.hibernate.admin.model.Role -> ROLE
[schemaexport] 21:26:56,625 INFO Binder:534 - Mapping collection: org.hibernate.admin.model.Role.users -> USER_ROLE
[schemaexport] 21:26:56,687 INFO Configuration:166 - Mapping file: D:\jws\app\adminapp-0.9.2\adminapp-0.9.2\src\java\org\hibernate\admin\model\User.hbm.xml
[schemaexport] 21:26:56,781 ERROR XMLHelper:48 - Error parsing XML: D:\jws\app\adminapp-0.9.2\adminapp-0.9.2\src\java\org\hibernate\admin\model\User.hbm.xml(81) Element "composite-element" does not allow "parent" here.
[schemaexport] 21:26:56,781 INFO Binder:225 - Mapping class: org.hibernate.admin.model.User -> users
[schemaexport] 21:26:57,625 INFO Binder:534 - Mapping collection: org.hibernate.admin.model.User.userRoles -> USER_ROLE
[schemaexport] 21:26:57,640 INFO Binder:534 - Mapping collection: org.hibernate.admin.model.User.roles -> USER_ROLE
[schemaexport] 21:26:57,640 INFO Binder:534 - Mapping collection: org.hibernate.admin.model.User.previousPasswords -> OLD_PASSWORDS
[schemaexport] 21:26:57,687 ERROR Configuration:174 - Could not configure datastore from file: D:\jws\app\adminapp-0.9.2\adminapp-0.9.2\src\java\org\hibernate\admin\model\User.hbm.xml
[schemaexport] net.sf.hibernate.MappingException: invalid mapping
[schemaexport] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:170)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:301)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[schemaexport] Caused by: org.xml.sax.SAXParseException: Element "composite-element" does not allow "parent" here.
[schemaexport] at org.apache.crimson.parser.Parser2.error(Parser2.java:3354)
[schemaexport] at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(ValidatingParser.java:349)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1497)
[schemaexport] at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
[schemaexport] at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
[schemaexport] at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
[schemaexport] at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
[schemaexport] at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
[schemaexport] at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
[schemaexport] at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
[schemaexport] at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:339)
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:219)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:169)
[schemaexport] ... 10 more
BUILD FAILED: D:\jws\app\adminapp-0.9.2\adminapp-0.9.2\build.xml:318: Schema text failed: net.sf.hibernate.MappingException: invalid mapping

I have tried this in hibernate2.1.6 , unfortunately get the similar error !

I want ask if the hibernate must obey the tag order , or this is a bug?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 6:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
See the DTD:

Code:
<!ELEMENT composite-element (
  (meta*),
  parent?,
  (property|many-to-one|any|nested-composite-element)*
)>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 15, 2004 2:26 am 
Newbie

Joined: Sun Sep 12, 2004 9:41 am
Posts: 3
thanks david

I find the issue when i try a demo use xdoclet. The mapping file generated by xdoclet not obey the order defined in dtd.


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