question « SQL « JPA Q&A





1. Newbie question on Hibernate... in context of Martin Fowler article    stackoverflow.com

In Domain Logic and SQL, Martin Fowler talks about 3 styles of interfacing with a database:

  1. Transaction Script
  2. Domain Model, and
  3. Logic in SQL
What I'd like to know is:
  1. When employing Hibernate for ...

2. Question about executing arbitrary native SQL    forum.hibernate.org

3. question about native SQL    forum.hibernate.org

Hi I am sure this question might have already asked/answered. If someone can point me any documentation or answer that will be great. Basically, I would like to write a native SQL using hibernate to update selective columns in one of my tables. Eg, I have a table TableA with 132 columns and I want to update only few columns, like ...

5. A question about native SQL in Hibernate3    forum.hibernate.org

6. SQL statement without question marks indicate ?    forum.hibernate.org

Please make sure that the confuguration files are used and free of typos. Make sure also that log4j's appender has appropriate threshold. Log should show something like this: Hibernate: delete from idfclient where exists (select dotaz1_.id from dotaz dotaz1_ where idfclient.dotaz_id=dotaz1_.id and dotaz1_.id=?) 1985 [main] DEBUG org.hibernate.type.StringType - binding 'a' to parameter: 1

7. A question on using Hibernate Native SQL    forum.hibernate.org

I am just trying out Hibernate Native SQL. Here is the section of my java code in my test class: SQLQuery insurance = session.createSQLQuery( "select * from ENTITLEMENTTYPE"); for (Iterator it = insurance.list().iterator(); it.hasNext();) { System.out.println(it.next().toString()); } It gives error: SEVERE: [IBM][CLI Driver][DB2/NT] SQL0204N "ZHOUP.ENTITLEMENTTYPE" is an undefined name. SQLSTATE=42704 If I specify the correct schema name above, the error goes ...

8. SQL setResultTransformer question    forum.hibernate.org

When using the following code: List ReportResult = session.createSQLQuery("select ......").setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list(); Map m = ( Map ) ReportResult.get(0); Iterator keys = m.keySet().iterator(); while (keys.hasNext()) { logger.debug( (String)keys.next()); } the order of the returned keys does not correspond to the order of the fields in the query, as a matter of fact, it does not correspond to any specific order. Shouldn't this leave ...

9. A beginners question: HQL vs SQL (and use of VB?)    forum.hibernate.org

Hi people, I have just started with Hibernate and read some of the tutorials of Gary Mak which I found here (big up for Gary, your tuts rule!) But I am still orintating om what method I should use. To make a long story short: I need to temporarily built a tool that can harvast data from a database. The database ...





10. No bug. Set / Lazy init / SQL behavior question    forum.hibernate.org

Hibernate 3.1.3 Oracle 10g Hi, I make this thread because the informations I have are not enough up to date for some, and can't be sure for some others, so I prefer to get a more "official" one. We use massively lazy loading. Take the example of an object "Entity". We have a lot of collections inside, but I dont care, ...

11. Newbie question - subselect mixing HQL & SQL? Or better    forum.hibernate.org

If mapping the Nickname table is not an option, you could map the property using a secondary table to join in the nickname value. If you're using annotations, it would look something like this: Code: @Table(name="person_table") @SecondaryTables({ @SecondaryTable(name="nickname_table", pkJoinColumns={ @PrimaryKeyJoinColumn(name="person_id", referencedColumnName="id") ), }) public ...

12. generated SQL question    forum.hibernate.org

I am doing the simple property change on my persistent object. The object itself is retrieved by session.load() . I would expect that only the 'update' SQL query would be generated by Hibernate. Instead, I see the 'select' query first that corresponds to loading the object and then 'update'. Is this normal behavior? If yes, that does not seem to be ...

13. best practice question wrt accomodating various SQL dialects    forum.hibernate.org

I am building an application using annotations and MySql as the database. As part of the testing for many classes I need to get the current time, but I'd like to write that query only once. Additionally, I have to supply MySql queries to drop, create, and populate tables. But none of them will work with other databases. It strikes me ...