Announcement Announcement Module
Collapse
No announcement yet.
Replacement for find in hibernate3 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 08:08 PM.

  • #2
    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.

    Comment


    • #3
      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.

      Comment


      • #4
        Same thing.

        Comment


        • #5
          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

          Comment


          • #6
            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});

            Comment


            • #7
              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.

              Comment

              Working...
              X