TechnoBuzz

A Techno Blog, mainly about Java

Native SQL in Hibernate3

         StringBuffer sql = new StringBuffer();
        sql.append("select david.field1 as myfield1, david.field2 as myfield2 drom david.table1");          
        SQLQuery sqlQuery = getSession().createSQLQuery(sql.toString());
        sqlQuery.addScalar("myfield1", Hibernate.TIMESTAMP);
        sqlQuery.addScalar("myfield2", Hibernate.INTEGER);
        List results = sqlQuery.list();

       

Advertisements

March 21, 2006 - Posted by | Hibernate & ORM

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: