Results 1 to 7 of 7

Thread: Replacement for find in hibernate3

  1. #1
    Join Date
    Jun 2005
    Posts
    3

    Default Replacement for find in hibernate3

    I am working on converting our application from hibernate2, spring 1.2 to hibernate3 spring 1.2.5.

    I have looked at the hibernate migration guide
    http://www.hibernate.org/250.html#A14 and this forum
    http://forum.springframework.org/showthread.php?t=13913

    but cannot find a replacement for

    List list = (List)getHibernateTemplate().findByNamedQuery(strB uf.toString(),new Object[]{assignRuleId},new Type[] {Hibernate.INTEGER});

    OR

    getHibernateTemplate().find(
    query ,new Object[]{locId,businessDate,gsIdType},
    new Type[]{Hibernate.INTEGER,Hibernate.DATE,Hibernate.STRING });


    Any help is appreciated. :cry:
    Last edited by robyn; May 14th, 2006 at 07:08 PM.

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    There have been some discussion on the forum about this topic - for the HB3 support it was decided to simply the template interface - the method is not there anymore but you can have the functionality using a HibernateCallback.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Jun 2005
    Posts
    3

    Default

    thanks.
    What about
    getHibernateTemplate().delete(q,new Object[]{tbsEntityId},new Type[]{Hibernate.INTEGER});

    getHibernateTemplate().delete(q,new Object[]{tbsEntityId,type},new Type[]{Hibernate.INTEGER,Hibernate.STRING});

    these seem to have disappeared too.

  4. #4
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Same thing.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  5. #5
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    Usually, there is no need for specifying the Hibernate types explicitly. Simply pass in the parameters and let Hibernate automatically figure out the types. That's why we removed the overloaded methods with the explicit type argument and just kept the ones with plain parameters. If you still need to pass in specific types, use a HibernateCallback.

    Juergen

  6. #6
    Join Date
    Jun 2005
    Posts
    3

    Default Cannot use delete with conditionin hibernate 3

    The following delete call worked in hibernate 2 but I cannot find am implementation for it in hibernate3. How do I achieve the same in hibernate3

    String q = "from entitySynonym in class com.gs.treasury.tbs.dm.dto.EntitySynonym where entitySynonym.tbsEntity.tbsEntityId = ? and entitySynonym.tbsSynonymType.synonymTypeName = ?";
    getHibernateTemplate().delete(q,new Object[]{tbsEntityId,type});

  7. #7
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    You place the whole code inside a HibernateCallback - i.e. instead of relying on a delete method on the template, you move the deleting part on the session directly.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Similar Threads

  1. Replies: 6
    Last Post: Sep 2nd, 2005, 05:03 AM
  2. XDoclet2 for Hibernate3
    By alesj in forum Data
    Replies: 1
    Last Post: May 4th, 2005, 03:00 PM
  3. Hibernate3 Bug?
    By gdboling in forum Data
    Replies: 1
    Last Post: Apr 20th, 2005, 11:49 AM
  4. Spring and Hibernate3
    By pascal in forum Data
    Replies: 4
    Last Post: Jan 4th, 2005, 01:58 AM
  5. Replies: 1
    Last Post: Aug 12th, 2004, 08:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •