Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate[newbie] eclipse

 
Pao Biamco
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi im using eclipse to generate the hbm.xml files , but the hbm.xml files are missing

<?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" >

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<!-- Created Tue Oct 11 09:23:17 CEST 2005 -->
<hibernate-mapping>
<class name="Rolepermissions" table="RolePermissions">
<property name="roleid" column="Roleid" type="integer" not-null="true" />
<property name="nodeid" column="Nodeid" type="integer" not-null="true" />
</class>

</hibernate-mapping>


The sql table looks like this
The is no pk for this table?

RolePermissions
RoleId NodeID
1 20
1 21
..


Best Regrds
 
Pao Biamco
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ! Again , i submit some additional exception log

ERROR - Log4JCategoryLog.error(180) | Error parsing XML: XML InputStream(15) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array|query-list)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*)".


Thanks for your help,
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The validation error is telling you what is wrong - the mapping file doesn't match the document structure the DTD defines. Specifically, you have a mapping file with no id element. Since you have an entity with no primary key that is no surprise really, because the relational model is invalid.
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
Sorry for my poor knowledge in database.
Can I interpret your statement
Since you have an entity with no primary key that is no surprise really, because the relational model is invalid.

as
Any table in relational database needs primary key.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Absolutely. A relational value must have a unique identifier to be relational, otherwise how do you identify it to participate in any relation? To put it more simply, how do you join from one table to another if you can't uniquely identify the records you are joining on? Give your table primary key - best, give them a surrogate key (i.e. one which is generated and nothing to do with the data the table represents) - and map that primary key with an <id /> element.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic