facebook

deprecated method in hibernate scaffolding

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #335365 Reply

    J. Braun
    Member

    MyEclipse for Spring Version: 10.6.0 Build ID: 10.6.0-20120831

    The reverse engineering for Hibernate created a DAO with the following lines:

      
    public void attachClean(Names instance)
      {
        log.debug("attaching clean Names instance");
        try
        {
          getSession().lock(instance, LockMode.NONE); // bad
    
          getSession().buildLockRequest(LockOptions.NONE).lock(instance); // good
          log.debug("attach successful");
        }
        catch (RuntimeException re)
        {
          log.error("attach failed", re);
          throw re;
        }
      }
    

    The line marked //bad was created by the scaffolding operation and was flagged as deprecated by the ME4S ide. I did research and created the line marked // good which works properly. This is using the Hibernate 4.1 libraries.

    #335407 Reply

    Brian Fernandes
    Moderator

    Braunj,

    Thank you for the report and the recommended code. I have filed a bug for this and we will have this fixed for our next release.

    #338669 Reply

    PrakashKamat
    Participant

    A)
    Reverse Engineering for Hibernate4/Spring3, creates the following code

    public void attachClean(DbsUser instance) {
    log.debug(“attaching clean DbsUser instance”);
    try {

    getHibernateTemplate().buildLockRequest(LockOptions.NONE).lock(instance);
    log.debug(“attach successful”);
    } catch (RuntimeException re) {
    log.error(“attach failed”, re);
    throw re;
    }
    }

    Note: Compiler Error -> The method buildLockRequest(LockOptions) is undefined for the type HibernateTemplate

    I just used the Hibernate/Spring Example on your site to test Spring 3.x/Hibernate 4.x functionality…If you need more details please let me know…

    B)

    Another problem, my reverse Engineering for Hibernate stopped working for some strange reason…After uninstall and install again seems to have solved the problem…A bit scary to know the problem could surface again…Any tips on this?

    C) When you import a project created using 10.x into professional, user defined libraries names and rar files are missing in the project explorer…

    Final Note: It is a bit frustrating to note that it is not easy to make a smooth transition to a newer version…Also tutorials need updating to the latest version released…e.g. Spring?Hibernate tutorial on the site seems to be for an older version…A simple Struts 2.x/Spring 3.x/Hibernate 4.x example on the site would a great help.

    Anyway, I really like the tool except for the occasional problems like this where you really get stuck without much help…I normally do not report problems…But this time I literally wasted 3 days to get the ide working properly…for the Spring 3 and Hibernate 4.

    Thanks once again…

    Prakash Kamat
    Ireland

    #338687 Reply

    Brian Fernandes
    Moderator

    Prakash,

    A) Yes, actually fixing the original problem mentioned in this thread caused this problem. Quite a bad oversight on our part that slipped through testing; we already have it fixed for the upcoming 2013 SR1 release due in a few weeks. In Spring-Hibernate cases, you do need to go back to the original code at the top of this thread.

    B) If you run into this again, please examine your error log for new entries. Am unsure what would cause it to suddenly break, without further details I cannot say more.

    C) The 2013 release is significantly different from our past releases (8, 9, 10) and migration of projects is required. If you opened your workspace with 2013, you should have been asked by a wizard to migrate your projects; did this not happen?
    Please see Introduction to 2013 for a brief overview of some of the key changes in 2013 – including the migration process.

    I’m sorry you experienced issues and appreciate the fact that you took the time to talk to us about them. If you have further experiences to share, please do not hesitate to contact us.

    #340531 Reply

    support-tony
    Keymaster

    The MyEclipse 2013 SR1 release is now available via the download page or via in-product update. Update sites should be available later this week.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: deprecated method in hibernate scaffolding

You must be logged in to post in the forum log in