-->
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: Mapping sequences in joined-subclasses
PostPosted: Wed Jan 18, 2006 9:45 am 
Beginner
Beginner

Joined: Wed Apr 27, 2005 8:27 am
Posts: 27
Hi everyone,

I am trying to map a sequence, a surrogate key, to my sub-class. I have tried the attribute 'generated' but but is did not work.

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="br.com.sapiensit.sigterra.administrativo.model.bo" default-lazy="false">

<class name="ObjetoImobiliarioBO" table="TB_OBJETO_IMOBILIARIO">
<id name="id" type="java.lang.Long" column="ID">
<generator class="sequence">
<param name="sequence">SQ_OBJETO_IMOBILIARIO</param>
</generator>
</id>

<property name="classe" column="TP_CLASSE_IMOBILIARIA"/>
<property name="tipo" column="TP_OBJETO_IMOBILIARIO" not-null="true"/>

<!-- mapeamento da subclasse ObjetoEspecialBO -->
<joined-subclass name="ObjetoEspecialBO" table="TB_OBJETO_ESPECIAL">
<key column="ID_OBJETO_IMOBILIARIO" />
<property name="id" column="ID" not-null="true" generated="insert"/>
<property name="descricao" column="DS_OBJETO_ESPECIAL" not-null="true"/>
</joined-subclass>

</class>
</hibernate-mapping>

The tables are:

TB_OBJETO_IMOBILIARIO

ID NOT NULL NUMBER(*,0)
TP_CLASSE_IMOBILIARIA NUMBER(*,0)
TP_OBJETO_IMOBILIARIO NOT NULL NUMBER(*,0)

and

TB_OBJETO_ESPECIAL

ID NOT NULL NUMBER(*,0)
DS_OBJETO_ESPECIAL NOT NULL VARCHAR2(100)
ID_OBJETO_IMOBILIARIO NOT NULL NUMBER(*,0)

How do I map my id in the joined-subclass (objetoEspecialBO) so it can be generated by a sequence (SQ_OBJETO_ESPECIAL) of the database?

Can anybody give me a hint?
Thanks, Guilherme


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.