-->
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: How to use formula?
PostPosted: Wed Jan 17, 2007 10:15 am 
Newbie

Joined: Tue Jan 16, 2007 9:54 am
Posts: 3
Hi, I have this in my mapping file:

<property name="bonnen" formula="SELECT SUM(bonnen) FROM verkoperdag" />

but when I try to use it, it say the column bonnen doesn't exist. Of course it doesn't exist, I want to return a formula result, not a database column. I've tried different queries, but all with the same result.

I've also tried to with and without a field+getter/setter in a POJO, but hibernate complains about missing getters and setters.

When I try to run hbm2java against this, it says the field "bonnen" doesn't exist and stops. When I add a type="float", it runs and generates normal getters and setters. hbm2ddl generates a column for data, which I don't want.

The documentation and examples found on google use similair examples, so what am I doing wrong?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 6:07 am 
Newbie

Joined: Tue Jan 16, 2007 9:54 am
Posts: 3
I still haven solved this yet. Is it even possible to use formula this way? That's what I understand from the documentation, but it just won't work. What am I doing wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 7:26 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Try to query SQL and not the Hibernate objects. An example from the test source code provided with Hibernate download:
org/hibernate/test/cid/Order.hbm.xml

_________________
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  
 
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.