[b]Hibernate version:[/b] 3.0.5 middlegen 2.1
[b]Sql commands:[/b]
/*==============================================================*/
/* Table: PAPER */
/*==============================================================*/
create table PAPER (
ID numeric(9) not null,
TYPE numeric(9) not null,
PAPERDESC varchar(255) not null,
GRAMATUR float(9) not null,
PDIMENSION float(9) not null,
LDIMENSION float(9) not null,
ENTRYUSER varchar(25) not null,
constraint PK_PAPER primary key (ID)
)
go
/*==============================================================*/
/* Table: PAPERPRICE */
/*==============================================================*/
create table PAPERPRICE (
ID numeric(9) not null,
HARGARIMPLANO float(9) not null,
HARGAPLANO float(9) not null,
REMARKS varchar(255) not null,
constraint PK_PAPERPRICE primary key (ID)
)
go
[b]Mapping documents:[/b]
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.2
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="marketingSystem.Paper"
table="PAPER"
>
<id
name="id"
type="java.lang.Integer"
column="ID"
>
<generator class="increment" />
</id>
<property
name="paperdesc"
type="java.lang.String"
column="PAPERDESC"
not-null="true"
length="255"
/>
<property
name="gramatur"
type="float"
column="GRAMATUR"
not-null="true"
length="24"
/>
<property
name="pdimension"
type="float"
column="PDIMENSION"
not-null="true"
length="24"
/>
<property
name="ldimension"
type="float"
column="LDIMENSION"
not-null="true"
length="24"
/>
<!-- Associations -->
<!-- bi-directional one-to-many association to PaperPrice -->
<set
name="paperPrices"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="ID" />
</key>
<one-to-many
class="marketingSystem.PaperPrice"
/>
</set>
<!-- bi-directional many-to-one association to User -->
<many-to-one
name="user"
class="marketingSystem.User"
not-null="true"
>
<column name="ENTRYUSER" />
</many-to-one>
<!-- bi-directional many-to-one association to PaperType -->
<many-to-one
name="paperType"
class="marketingSystem.PaperType"
not-null="true"
>
<column name="TYPE" />
</many-to-one>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.2
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="marketingSystem.PaperPrice"
table="PAPERPRICE"
>
<id
name="id"
type="java.lang.Long"
column="ID"
>
<generator class="assigned" />
</id>
<property
name="hargarimplano"
type="float"
column="HARGARIMPLANO"
not-null="true"
length="24"
/>
<property
name="hargaplano"
type="float"
column="HARGAPLANO"
not-null="true"
length="24"
/>
<property
name="remarks"
type="java.lang.String"
column="REMARKS"
not-null="true"
length="255"
/>
<!-- Associations -->
<!-- bi-directional one-to-many association to PaperPriceHistory -->
<set
name="paperPriceHistories"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="PAPERPRICEID" />
</key>
<one-to-many
class="marketingSystem.PaperPriceHistory"
/>
</set>
</class>
</hibernate-mapping>
[b]Question:[/b]
I generate my hibernate xml using middlegen 2.1, the relation on database is one to one, but middlegen generated it one-to-many for me, any body can help me on this? i tried oracle9i and sqlserver, it generate me the same relationship.
thank you