-->
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.  [ 2 posts ] 
Author Message
 Post subject: Using a component?
PostPosted: Tue Mar 09, 2004 8:39 pm 
Newbie

Joined: Fri Mar 05, 2004 3:22 pm
Posts: 8
Hibernate 2.1 - Oracle 9i

Hi everybody

I have this schema in my data model:

A table named "Comercio" and a table named "Dom".

The "Dom" table have the Comercio_ID column.

In the businnes part, I have this (domain layer) objects:

One Called "Negocio" whit these properties:

public class Negocio extends Comercio
{

/**
* @roseuid 4048BB1702AC
*/
public Negocio()
{

}
}

And "Comercio", that is an abstract class:

public abstract class Comercio extends ComercioLight implements IComercio
{
......

private IDom m_domicilioComercial;
private IDom m_domicilioFiscal;
......
}
And my persistent class DomNac (extends Dom that implements IDom):

public class DomNac extends Dom
{
......
private Long m_sucursal;
......
}

I also give you the Dom abstract class:

public abstract class Domicilio implements IDom
{
private long m_oid;
private String m_calle;
.......
}

and IDom:

package mx.com.prosa.bdu..... blah blah;
public interface IDomicilio
{
}

Then I have my mapping documents, obviously from my Two objects in cuestion: DomNac object to the Dom Table and the Negocio Object to the Comercio table.

If you have noticed, the comercio object, have two dom objects, from the IDom type, I think the problem is in there.

____________________________________
NEGOCIO MAPPING:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="mx.com.prosa.bdu.dmn.mantenimiento.comercio.negocio.Negocio"
table="TBL_BDU_COMERCIOS" lazy="true">
<id name="id">
<column name="oid" sql-type="int" not-null="true"/>
<generator class="increment" />
</id>

<many-to-one name="banco"
column="COM_BCO_ID" class="mx.com.prosa.bdu.dmn.mantenimiento.catalogo.banco.light.BancoLight"/>
<many-to-one name="status"
column="COM_ESTATUS_ID" class="mx.com.prosa.bdu.dmn.mantenimiento.comercio.status.StatusComercio"/>
<many-to-one name="cadena"
column="COM_CAD_ID" class="mx.com.prosa.bdu.dmn.mantenimiento.cadena.light.CadenaLight"/>

<property name="nombre" column="COM_NOMBRE" />
<property name="afiliacion" column="COM_AFILIACION" not-null="true"/>

<property name="propietario" column="COM_PROPIETARIO" />

<property name="razonSocial" column="COM_RAZON" />
<property name="afilianter" column="COM_AFILIANTER" />
<property name="rfc" column="COM_RFC" />

<many-to-one name="giro" column="COM_GIRO_ID"
class="mx.com.prosa.bdu.dmn.mantenimiento.catalogo.giro.Giro"/>

<component name="domicilioComercial"
type="mx.com.prosa.bdu.dmn.mantenimiento.comercio.domicilio.DomNac"
insert="true" update="true" >
<property name="oid"/>
<property name="calle"/>
<property name="codigoPostal"/>
</component>

</class>
</hibernate-mapping>


____________________________________

I try to run my app, but I get this exception:


18:37:21,062 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
18:37:21,171 INFO [Configuration] Mapping resource: mx/com/prosa/bdu/eai/hbm/Negocio.hbm.xml
18:37:21,281 ERROR [XMLHelper] Error parsing XML: XML InputStream(43) Attribute "type" must be declared for element type "co
mponent".
18:37:21,812 INFO [Configuration] Mapping resource: mx/com/prosa/bdu/eai/hbm/Negocio.hbm.xml
18:37:21,875 ERROR [XMLHelper] Error parsing XML: XML InputStream(43) Attribute "type" must be declared for element type "co
mponent".
18:37:21,890 ERROR [STDERR] net.sf.hibernate.MappingException: Error reading resource: mx/com/prosa/bdu/eai/hbm/Negocio.hbm.
xml
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:318)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:976)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842)


____________________________________

And I don't know how to mapp this relation father-son having a comercio that have two dom inside

Please help!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2004 4:38 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Study the DTD. type is irrevelent for component (should be class in your case)

_________________
Emmanuel


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