facebook

No Hibernate support if I’m using Spring?

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #233700 Reply

    lchuenya
    Member

    Hi,
    I’m using Spring’s Hibernate support. Spring doesnt require hibernate.cfg.xml to be present. Therefore I’m not able to properly enable Hibernate capabilities for a project.

    Does it mean that I cannot use Hibernate capabilities in MyEclipse if I’m using Spring?

    #233728 Reply

    Riyad Kalla
    Member

    Does it mean that I cannot use Hibernate capabilities in MyEclipse if I’m using Spring?

    This may require some fudging. MyEclipse’s hibernate capabilities are not aware of Spring’s support for them, so it will generate the hibernate.cfg.xml file for you. You can of course merely ignore this file during runtime and let Spring handle the Hibernate configuration instead.

    #237120 Reply

    Randy
    Member

    Hi,
    I’m not sure if this is related to the previous post, but it seems a reasonable place to start. If I try to set properties for my hibernate session in the applicationContext.xml, it does not get read. ie:

                <props>
                    <prop key="hibernate.dialect">
                        org.hibernate.dialect.PostgreSQLDialect
                    </prop>
                    <prop key="hibernate.show_sql">true</prop>
                    <prop key="hibernate.max_fetch_depth">3</prop>
                    <prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
                </props>

    The one of interest is the cglib.use_reflextion_optimizer. This property is ignored (and so is the show_sql statement). If I have a hibernate.properties file in my classpath with this, I can set things so I can debug, etc. If I remove the hibernate properties, it complains about it, but the wierd thing is that it can still connect to the database (which makes me think it is reading at least part of this stuff from the applicationContext). The REALLY wierd thing is that the max_fetch_depth IS read properly.

    Kinda bizzare. For now, I can get stuff done by having a hibernate.properties file with the tweeks in it, but I’m a bit curious about this.

    TIA!
    randy

    #237125 Reply

    Riyad Kalla
    Member

    Randy,
    What version of HIbernate are you using? Are you using Spring to configure hibernate? Just an FYI: MYEclipse doesn’t do ANYTHING custom to any of the libs we ship, so there is no “MYEclipse Magic” happening here incase you were wondering. If you took this project and ran it using Notepad you’d get the same result most likely (unless there is a classpath issue with your application server connector or something like that).

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: No Hibernate support if I’m using Spring?

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