-->
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: "undefined alias: null" in SELECT clause
PostPosted: Mon Feb 09, 2004 10:44 am 
Newbie

Joined: Mon Feb 09, 2004 10:37 am
Posts: 3
hi,

I've got a class myClass having a constructor

public new myClass(Object arg0, Object arg1, Object arg2).

I'm trying to select sth from my DB and have a result in the instances of myClass.

let's assume I've got my_table in the DB, havin 3 fields


If I do

SELECT new myClass(t.f1, t.f2, t.f3) FROM myTable AS t

then it works, but if I want the application not to select t.f3 from the DB,
and I want to initialize myClass with 2 fields only it doesn't work? WHY???

SELECT new myClass(t.f1, t.f2, null) FROM myTable AS t

gives me an exception

"undefined alias: null "


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 10:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can't use constants or nulls there. Why don't you just create a second constructor which takes two arguments and calls the first constructor?


Top
 Profile  
 
 Post subject: "undefined alias: null" in SELECT clause
PostPosted: Mon Feb 09, 2004 10:55 am 
Newbie

Joined: Mon Feb 09, 2004 10:37 am
Posts: 3
gloeglm,

thank You, at least now I know it is not possible to use null in the constructor in SELECT clause. I don't want to create a constructor in this class, since this class has been generated automatically and every time I change DB, I generate all my persistent classes, so I don't want to creat anything in such classes.
But nonetheless thanks a lot

Maciek


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 12:00 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
inherit the generated class and add the constructor.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 1:12 pm 
Newbie

Joined: Mon Feb 09, 2004 10:37 am
Posts: 3
OK folks,

thank You a lot. I did, like you mentioned

regards
Maciek


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.