-->
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: SELECT a column as NULL
PostPosted: Tue Oct 18, 2005 9:22 pm 
Newbie

Joined: Tue Oct 18, 2005 9:14 pm
Posts: 2
Hello

I am fairly new to Hibernate . I would like to execute the following query and I am constructing a HSQL statement for it.

Select
value1 as X1,
null as X2
from
TEST_TABLE

I have the TEST_TABLE mapped to a TEST_OBJECT. The following HSQL statement fails

select
new TEST_OBJECT (
value1Obj,
null
) from
TEST_OBJECT

This fails with an exception Invalid alias null for Query.Could someone help me with this.


Thanks


Top
 Profile  
 
 Post subject: Re: SELECT a column as NULL
PostPosted: Tue Oct 18, 2005 9:26 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Why don't you create a constructor that doesn't take the 2nd argument and sets the field to NULL for you ?

And BTW: TEST_OBJECT, while valid, is not a very good name for a Java Class based on generally accepted practices.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 9:39 pm 
Newbie

Joined: Tue Oct 18, 2005 9:14 pm
Posts: 2
Thank you very much for the quick response.

The select statement was just an example. I have the class name different in my application.

Wondering if there is any aggregate function to set null for columns selected forcibly.


Regards


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.