sql « Session « JPA Q&A





1. Get SQL for Session?    forum.hibernate.org

Hello, Short story: Is there a way for me to get the SQL that Hibernate generates when I save a pojo to a Session? Long story: I am using Hibernate to integrate 2 different databases with my Java application. On the one hand, I have a MySQL database on a particular server. On the other hand, each distribution of my application ...

2. Error Creating SessionFactory in netbeans 6.8 and sql    forum.hibernate.org

Hi i am new to hibernate and trying to insert data from jsp from and insert into mysql here is my mapping file and cfg file...and exception pleas any one help me to solve this... Hbm file true

3. Should save/merge generate sql if session is not flushed?    forum.hibernate.org

Hello, Should save or merge generate an insert statement if the session is not flushed? I realise that it would have to if you were using a sql server identity column (because it needs to go straight to the database to get it), but I thought it wouldn't if you were using a different type of primary key such as a ...

4. Hand-coded SQL with a Session Object    forum.hibernate.org

Hi, I may use Hand-coded SQL to manage some complex SQL requests, without any use of the O/R mapping hibernate utilities, and receiving a java.sql.ResultSet or a ResultSet-like response. I'd like to keep the current connection (to keep the transaction functionality). What is the right way to do that ? Thanks in advance ! Yann

5. execute an SQL script in a file using session    forum.hibernate.org

Have you done this without hibernate before? Assuming you have used a JDBC driver to do some form of processing then you can get the connection from the session object. Otherwise I cannot think of a use case for this. Where I have SQL to execute then it usualy processed it manually or by Ant. I suppose you could fork a ...

6. Capture or redirect the session SQL output    forum.hibernate.org

This is a general "is it possible question". My problem at hand is to create a SQL insert, update, delete script based on a set of captured (or known) modifications to one or more tables. Given a valid hibernate mapping over the relational model, I'm trying to determine if it possible to do something like: - Open a hibernate session. - ...

7. Exporting Session sql statements to file    forum.hibernate.org

yeah i had thought about that. Couple problems with that though. I don't want it to actually execute the update/insert statements. I just want hibernate to write out what it would have done...and ill bulk load it later. Also, I don't want the random select statements that other session's might produce... Good thought though... LT

8. logging sql per session    forum.hibernate.org

9. How to fire static sql before doing work on session    forum.hibernate.org

Hi, I have a fairly simple question that I'm hoping someone can help me with... We decided to use Oracle Workspace Manager for our current project and so now I need to have a static sql statement fired right after opening any session which just connects a use to the correct workspace. The sql statement itself isn't important but I was ...





10. Generated SQL not valid from session.createSQLStatement    forum.hibernate.org

Newbie Joined: Fri Aug 04, 2006 3:01 pm Posts: 13 Hi fellas, I need to execute a request in native SQL through Hibernate. I want to retreive all the 'Programme' entities related to the 'Etudiant' entities for a given 'enquete_id' of the 'Etudiant'. Simply put, in which academic programs are the students of a given survey. I use : Code: private ...

11. Generated SQL not valid from session.createSQLStatement    forum.hibernate.org

Newbie Joined: Fri Aug 04, 2006 3:01 pm Posts: 13 Hi fellas, I need to execute a request in native SQL through Hibernate. I want to retreive all the 'Programme' entities related to the 'Etudiant' entities for a given 'enquete_id' of the 'Etudiant'. Simply put, in which academic programs are the students of a given survey. I use : Code: private ...

12. can i use sql "update" using session.createSQLQuer    forum.hibernate.org

Hi all, i got a question, can i use sql "update" using session.createSQLQuery ? My code is like this : String sqlQuery = "UPDATE HP_COUNTRIES4MODEL b SET item_id = " + "NVL((SELECT item_id FROM HP_MODEL_MASTER a " + "WHERE a.item_name = b.item_display_name), 0)"; Query query = session.createSQLQuery(sqlQuery); query.uniqueResult(); but it always returning exception :( can somebody help me ? Thank you. ...

13. bad sql is killing my sessionfactory    forum.hibernate.org

Has anyone every experienced their session factory (I happen to use PostgreSQL) get hosed when a bad SQL throws an error. It seems if I have a typo or otherwise invalid SQL it throws an error and all my connections are placed in an error state. If I restart the session factory, i.e. pool it fixes it. I swear I am ...

14. Need to run set of sql code for each new session    forum.hibernate.org

Hi, I guess I can think of two ways at least and hopefully serves your need.. 1)Use a HibernateSessionFilter on the URL's you are interested in and in the filter execute/run the code you wish to. 2)Do you have a centralized place for getting Hibernate session? We use a Utility class which returns the Session Object. The class definition looks something ...