-->
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: property and formula
PostPosted: Tue Oct 04, 2005 1:06 pm 
Beginner
Beginner

Joined: Wed Sep 28, 2005 3:29 am
Posts: 20
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.1
Hi

I have a mapping file which contains the following property
<property name="bruttobetrag" formula="(1+(mwst/100))*(vk * stk)" type="double"></property>

I would like to round the result of the formula. how could i do this?

thx


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 1:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use the round function from your database ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 1:18 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
if you dialect support round you can try


Code:
<property name="bruttobetrag" formula="round((1+(mwst/100))*(vk * stk))" type="double"></property>


or do round in java (in getter)

regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 1:57 am 
Beginner
Beginner

Joined: Wed Sep 28, 2005 3:29 am
Posts: 20
Thank you for your help

another question:

<property name="bruttobetrag" formula="(1+(mwst/100))*(vk * stk)" type="double"></property>
<property name="test" formula="3+bruttobetrag" type="double"></property>

is it possible to write something like my example.
could i use a "nested" property in my formula? (please see the test-property, where i would like to use the bruttobetrag-property.

thx


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 8:45 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
You can't do it , but you can resolve this in java, easy

create simple getter like

Code:
public float getTest() {
  return 3+bruttobetrag;
}


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.