-->
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.  [ 3 posts ] 
Author Message
 Post subject: [one-to-one] with blank in the foreign key
PostPosted: Wed Apr 05, 2006 11:06 am 
Newbie

Joined: Thu Mar 02, 2006 10:59 am
Posts: 8
Location: Paris
hello

i have a relation one-to-one with foreign key like this
Code:

<many-to-one
            name="acte"
                    class="XXX.model.Acte"
                    column="CODE_ACT"
                unique="true"
                insert="false"
                update="false"
                lazy="false"
>

The CODE_ACT is a string with length = 3 characters
the relation works well

but when i have a CODE_ACT with 1characters and two blank (length=3)
the relation is broken

How can i precise the trim in hibernate on the column

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 05, 2006 6:03 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Hello Seb,

I am just wondering why a String contating blancs is distinguished from another character. May be the problem is located in your application.

Could you post a simple case showing the problem.

regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 06, 2006 4:26 am 
Newbie

Joined: Thu Mar 02, 2006 10:59 am
Posts: 8
Location: Paris
i have found the solution by putting this in the hibernate mapping file :
Quote:
formula="case when CODE_ACT is not null then trim(CODE_ACT) end"

thx


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