-->
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.  [ 7 posts ] 
Author Message
 Post subject: sql-type errors when moving from 2.0.3 to 2.1.1
PostPosted: Fri Jan 02, 2004 9:10 pm 
Newbie

Joined: Sun Dec 21, 2003 7:28 pm
Posts: 2
Location: Norway
Hi forum :)

I decided to move an application I make from version 2.0.3 to version 2.1.1
I started getting MappingException: duplicate import, on almost all my mapping files.

After some searching I found that I
-could not use sql-type attribute in a property that is inside a subclass. In a property outside the subclass it's fine.
-could not use sql-type attribute in many-to-one

examples:

Property inside a subclass
<property name="image1" sql-type="varchar(100)"/>
Ok in 2.0.3 not in 2.1.1

<many-to-one name="company" sql-type="varchar(32)" not-null="true"/>
Ok in 2.0.3 not in 2.1.1

Have anyone noticed similar?

Best regards
Terje


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 03, 2004 2:32 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Look at the hibernate-mapping-2.0.dtd.

sql-type is only an attribute in the column element, which is used in a few places.

The way you are using it looks incorrect. You should be using the type attribute (+ length for string types).


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 5:24 pm 
Newbie

Joined: Sun Dec 21, 2003 7:28 pm
Posts: 2
Location: Norway
You are right.. I have been violating the DTD all the time.

I guess I got confused by the exception; MappingException: duplicate import
It would be better with a message telling the real cause; sql-type is not allowed used in a property.

I changed to :

<many-to-one name="company">
<column name="company_id" sql-type="varchar(32)" not-null="true"/>
</many-to-one>

<property name="image1">
<column name="image1" sql-type="varchar(100)" not-null="false" />
</property>

which works well.

regards
TErje


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 6:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Terje wrote:
I guess I got confused by the exception; MappingException: duplicate import
It would be better with a message telling the real cause; sql-type is not allowed used in a property.


There actually should be such a message in your log, even though a little before the duplicate import error.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2004 1:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The spurious duplicate import error is a bug, we need to fix that.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2004 6:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I think this should be easy to patch, I added this to JIRA as HB-605


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2004 2:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Thanks :)


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