facebook

Projects point wrongly to hibernate.cfg.xml [Closed]

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

    When I tried to run a Hiberate project it was not able to find the hibernate.cfg.xml file. The reason –
    when I right click and saw in the project properties that the
    MyEclipse-Hibernate config is set as /TestHibernate/hibernate.cfg.xml
    when it should be set as /hibernate.cfg.xml ( TestHibernate is my project name.) I think the project should point to the right /hibernate.cfg.xml i.e, relative path, although one can set the MySql-Hibernate property easily.

    Environment- Eclipse 3.8.0 Beta-2, jdk1.4, Eclispe 3.0

    #210081 Reply

    I am also not able to find /hibernate.cfg.xml even when I used the absolute path.

    #210169 Reply

    support-michael
    Keymaster

    I just entered a problem report re: this behavior. The config path is are being confused but that is not the problem. The problem is that Configuration#configure() is unable to find the default “hibernate.cfg.xml” file. The reason for this is that the Configuration class expects hibernate.cfg.xml to be on the classpath and in a root directory. So rather than place the hibernate.cfg.xml file in the project’s root folder place it in the root level of the project’s Java source folder.

    For example my test project looks like this:

    TestHbmProject
    /src
    /bin
    /lib

    My hibernate.cfg.xml file resides at /src/hibernate.cfg.xml. The wizards are being upgraded to detect when the project’s hibernate config file is not on the classpath.

    Also please note that when you use the DB Explorer’s “export thru hibernate” feature that the hibernate.cfg.xml is not currently updated. You must add the <mapping resource=”com/test/MyClass.hbm.xml”/> entry by hand. This capability is being implemented now and will be in the upcoming GA release.

    #212325 Reply

    Riyad Kalla
    Member

    Fixed in 3.8 GA (Defaults to /src package)

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Projects point wrongly to hibernate.cfg.xml [Closed]

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