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: Using NHibernate just to convert to native SQL
PostPosted: Wed Feb 18, 2009 7:22 am 
Newbie

Joined: Wed Feb 18, 2009 7:10 am
Posts: 3
Location: London
Hi,
Sorry if this is a waste of time, but I wanted to know if its possible to use NHibernate to convert from HQL to the native SQL without having to persist the data in classes.

I have an application which needs to connect to both Oracle and MSSQL servers and would prefer not to have to write two seperate queries for each

Thanks

Ryan

_________________
-- Ryan Puddephatt


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 23, 2009 10:34 am 
Newbie

Joined: Wed Feb 18, 2009 7:10 am
Posts: 3
Location: London
Is this too obvious a question? I really need to know a simple yes or no as to whether it supports it?

If it does a URL to get me started and I'll be happy to work from there

Thanks

Ryan

_________________
-- Ryan Puddephatt


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 02, 2009 4:38 am 
Regular
Regular

Joined: Mon Jul 18, 2005 4:10 am
Posts: 92
Location: Poland
It depends what you mean by "persist the data in classes" .

You need to write classes and mappings to use HQL.

You can return non-persistable objects from HQL queries (projection queries) - as array of object() or array of DTO objects (select new DTOObject1(obj.col1,obj.col2 , ...) ....

_________________
michal


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 02, 2009 6:17 am 
Newbie

Joined: Wed Feb 18, 2009 7:10 am
Posts: 3
Location: London
michal,
Thanks for the reply.

Basically I want to use NHibernate to query a database using HQL and just return the data. I do not want a class for each table

Is this possible? Or is there something else that is suitable?

Thanks

Ryan

_________________
-- Ryan Puddephatt


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 02, 2009 6:36 am 
Regular
Regular

Joined: Mon Jul 18, 2005 4:10 am
Posts: 92
Location: Poland
As far I know you need the classes.

Take a look at My Generation project, it can help to automate the process of classes/mappings creation http://www.mygenerationsoftware.com.

_________________
michal


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.