-->
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: Dynamic Instantiation w/Native SQL Queries
PostPosted: Thu Aug 18, 2005 5:31 pm 
Beginner
Beginner

Joined: Wed Jun 29, 2005 10:40 am
Posts: 30
Location: denver, co
Is it possible to use Dynamic Instantiation in native sql queries?

In hql, you can do this:
Code:
select new SomeObject(persitentObj.Id, persitentObj.Name) from PersistentClass persitentObj where...


Is there a sql query parallel, or is it something obvious that I'm not seeing?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 9:19 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
AFAIK, it is not possible in native SQL.

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 6:02 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
I must be confused, as this looks pretty straight forward.

SQL:
Code:
select t.ID, t.NAME from Table t where .....

App Code:
Code:
ArrayList foo = new ArrayList();
... get DataReader from Command and loop through it ...
foo.Add( new SomeObject( reader["ID"], reader["NAME"] ) );
... close connection ...

Now 'foo' is a collection of your custom object. This should be very similar to what NHibernate would do internally. Since NH can do it, it must be possible.


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.