• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate[newbie] eclipse

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 686
Mac
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic