-->
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.  [ 5 posts ] 
Author Message
 Post subject: Middlegen R3 not mapping UNIQUE columns
PostPosted: Mon Nov 17, 2003 7:45 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
I'm using Middlegen R3 to generate my mapping files.
Seems to me that columns that have the constraint UNIQUE are not mapped with the property unique="true".

Is it a bug or is it configurable?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 9:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Should be working fine. Just to make sure I have the correct context can you show a snipt of the schema and the resulting snipit of mapping document.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2003 5:15 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
david wrote:
Should be working fine. Just to make sure I have the correct context can you show a snipt of the schema and the resulting snipit of mapping document.


Here's a small example:

DDL for table
---------------

CREATE TABLE MP (
id INT8 NOT NULL
, referencia TEXT NOT NULL CONSTRAINT mp_ref_unique UNIQUE
, designacao TEXT NOT NULL
, modelo TEXT
, tipo TEXT
, peso DECIMAL(10,2)
, fornecedor_fk INT8 NOT NULL
, data_monitorizacao DATE
, desenho_material TEXT
, norma TEXT
, legislacao TEXT
, fabricante TEXT
, estado CHAR(1)
, estado_monit TEXT
, user_id CHAR(10) NOT NULL
, dt_hr TIMESTAMP(10) NOT NULL
, PRIMARY KEY (id)
);

Mapping file generated by R3
----------------------------------

<!--
Created by Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class
name="pt.comseal.arsol.hibernate.Mp"
table="mp"
>

<id
name="id"
type="long"
column="id"
>
<generator class="increment" />
</id>

<property
name="referencia"
type="java.lang.String"
column="referencia"
not-null="true"
length="-1"
/>
<property
name="designacao"
type="java.lang.String"
column="designacao"
not-null="true"
length="-1"
/>
<property
name="modelo"
type="java.lang.String"
column="modelo"
length="-1"
/>
( - continued - )

As you can see, the column "referencia" is not mapped with unique="true". By the way, what's the name of the property file for Middlegen.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2003 8:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Hmmmmm......... I have check this and your right. The code delegates to Middlegens core column meta data to determine if its unique or not. Well the method is not to been seen in the latest code. I had this functionality from r1 . Not sure what happened. Have to try and chance it up. Thanks for the info sorry there is no quick fix as its a Middlegen core issue.

The properties file is <name>-prefs.properties where <name> is the name used to launch Middlegen, eg, in the supplied sample its airline-prefs.properties .


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2003 1:03 pm 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
david wrote:
Hmmmmm......... I have check this and your right. The code delegates to Middlegens core column meta data to determine if its unique or not. Well the method is not to been seen ...


Ok. Thanks for the reply.


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