What is the alternate for deprecated Hibernate.createClob(Reader reader, int length)

后端 未结 3 1078
轮回少年
轮回少年 2020-12-21 01:33

Seems like Hibernate.createClob(Reader reader, int length) is deprecated in version 3.6.x And it suggests to use Use LobHelper.createClob(Reader, long)

3条回答
  •  清歌不尽
    2020-12-21 02:26

    It is the way of simplifying the usage by hiding the implementations. If you want to use the Clob data you need to use the below code. I have tested it in version hibernate 3.6.

    session.getLobHelper().createClob("the_string");
    

    Now coming your second point about the working of it, if you read the source code of org.hibernate.impl.SessionImpl class you will know how internally hibernate handles this.

    public LobHelper getLobHelper()
    /*      */   {
    /* 2245 */     if (this.lobHelper == null) {
    /* 2246 */       this.lobHelper = new LobHelperImpl(this, null);
    /*      */     }
    /* 2248 */     return this.lobHelper;
    /*      */   }
    

提交回复
热议问题