-->
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.  [ 6 posts ] 
Author Message
 Post subject: Execute a Query using the table directly.
PostPosted: Fri Nov 28, 2003 11:28 am 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
Hi, I need to execute a query using the table directly, not using the class mapped because I have an atributte in the table that I don't want in the class.
Is it possible with Hibernate?.
Thanks.


Top
 Profile  
 
 Post subject: Re: Execute a Query using the table directly.
PostPosted: Fri Nov 28, 2003 11:35 am 
Regular
Regular

Joined: Thu Nov 20, 2003 10:44 am
Posts: 58
Location: Paris, France
Jean Cartier wrote:
Hi, I need to execute a query using the table directly, not using the class mapped because I have an atributte in the table that I don't want in the class.
Is it possible with Hibernate?.
Thanks.


Create another class without mapping the column you don't need


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 11:56 am 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
What I want to do is execute a query from the table directly, without using the class. Ex:

I 've got a table named "TableClients" with the attributes "id", "name" and "status", and I've got a Class named "Clients" with the attributes "id" and "name". Now I want to execute the following query:

SELECT id, name FROM TableClients WHERE status = 1;

Note that the attribute "status" is not visible from the class "Clients"; for this reason I can't use the session.createQuery or session.Iterate, etc.

What can I do?
Thanx.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 12:03 pm 
Regular
Regular

Joined: Thu Nov 20, 2003 10:44 am
Posts: 58
Location: Paris, France
Jean Cartier wrote:
What I want to do is execute a query from the table directly, without using the class. Ex:

I 've got a table named "TableClients" with the attributes "id", "name" and "status", and I've got a Class named "Clients" with the attributes "id" and "name". Now I want to execute the following query:

SELECT id, name FROM TableClients WHERE status = 1;

Note that the attribute "status" is not visible from the class "Clients"; for this reason I can't use the session.createQuery or session.Iterate, etc.

What can I do?
Thanx.


I don't really understand your point : either use directly jdbc or Hibernate !
Anyway it doesn't cost a lot to create a bean to do that.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 12:57 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
Exists a way to execute a raw sql query using hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 12:59 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
session.connection()

and in Hibernate 2.1

session.createSQLQuery()

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.