-->
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.  [ 1 post ] 
Author Message
 Post subject: Relation one-to-one fails: refers to an unmapped class: long
PostPosted: Tue Dec 04, 2007 10:42 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
Hibernate version: 3.2.5GA , and mapping done as referred
for one-to-one relations at http://www.hibernate.org/hib_docs/v3/re ... tional-121.
But keeps on failing(stacktrace in last paragraph) saying I must
map an identifier of type long created natively !??!!?

Mapping documents:

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name=mypackage.SimpleService"
table="SERVICES">
<id name="id" column="SERVICE_ID">
<generator class="native"/>
</id>

<one-to-one name="permissions"/>

<property name="date" type="timestamp"
column="CREATION_DATE"/>

<set name="names" table="SERVICE_NAMES">
<key column="SERVICE_ID"/>
<element column="name" unique="true"
not-null="true" type="string"/>
</set>
</class>
<class name="mypackage.ServicePermissions"
table="SERVICE_PERMISSIONS">

<id name="id" column="SERVICE_ID">
<generator class="foreign">
<param name="property">SimpleService</param>
</generator>
</id>

<one-to-one name="serviceId" constrained="true"/>

<map name="permissions" table="SERVICE_USERPERMISSIONS" cascade="all">
<key column="id_servicepermissions"/>
<index column="usr" type="string"/><!--pq obliga a meter index-->
<many-to-many column="id_permissions"
class="mypackage.Permissions"/>
</map>
</class>


<class name="mypackage.Permissions" table="PERMISSIONS">
<id name="id" unsaved-value="0">
<generator class="increment"/>
</id>
<property name="usr" type="string" not-null="true"/>
<property name="read" type="boolean" not-null="true"/>
<property name="write" type="boolean" not-null="true"/>
<property name="execute" type="boolean" not-null="true"/>
<property name="delete" type="boolean" not-null="true"/>
</class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
Exception in thread "main" java.lang.ExceptionInInitializerError
at mypackage.HibernateUtil.<clinit>(HibernateUtil.java:19)
at mypackage.SimpleServer.main(SimpleServer.java:164)
Caused by: org.hibernate.MappingException: An association from the table SERVICE_PERMISSIONS refers to an unmapped class: long
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1134)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1052)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1168)
at mypackage.HibernateUtil.<clinit>(HibernateUtil.java:14)
... 1 more


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.