-->
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.  [ 6 posts ] 
Author Message
 Post subject: not-null attribute (customize reveng)
PostPosted: Wed Apr 11, 2007 11:21 am 
Newbie

Joined: Thu Apr 05, 2007 5:29 am
Posts: 14
Location: France - Angers / Nantes
Is there a simple way to get the 'not-null' attribute in my hbm.xml (for the ?

Otherwise is there some wonderful guy to help me to customize the template ? I need the 'not-null' attribute to be filled in 'many-to-one' and 'property' elements ...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 3:36 am 
Newbie

Joined: Thu Apr 05, 2007 5:29 am
Posts: 14
Location: France - Angers / Nantes
I'll try to do it by my self ... without any knowledge about freemarker.

I want to add something like this in many-to-one.hbm.ftl and property.hbm.ftl :

Code:
<#if property.isNotNull>
            not-null="true"
</#if>


But the isNotNull method does not exist (it would be too easy !).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 5:25 am 
Newbie

Joined: Thu Apr 05, 2007 5:29 am
Posts: 14
Location: France - Angers / Nantes
I searched in hibernate API and I find org.hibernate.mapping.Property
so I tried
Code:
<#if property.value.nullable>
            not-null="true"
</#if>


I havn't got anymore exception but now all the property and many-to-one elements have not-null="true" !?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 7:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
maybe the reverse engineering doesn't initialize that flag correctly ?

Could you report it in jira ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 8:15 am 
Newbie

Joined: Thu Apr 05, 2007 5:29 am
Posts: 14
Location: France - Angers / Nantes
It work finally,

I add this in the many-to-one.hbm.ftl and property.hbm.ftl :
Code:
<#if !property.value.nullable>
            not-null="true"
<#else>
            not-null="false"
</#if>


I forgot a "!" before ;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 8:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ah ;)

_________________
Max
Don't forget to rate


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