facebook

Hibernate issues in 4.1.0

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

    jarethk
    Member

    I recently upgraded from 3.8.3 to 4.1.0 and I’m having serious troubles with the new Hibernate tools in Database Explorer.

    Eclipse 3.1.1
    MyEclipse 4.1.0
    JDK 1.4.2.08
    Oracle 9i

    In Database Explorer I select a table, choose Generate Hibernate Mapping, step through the wizard, and at the end I have to specify a JDBC datatype for every field. If I don’t enter them all then the mapping won’t run. I didn’t have to do this in the past. Why doesn’t the reverse-engineer auto-detect these any more?

    — David Fuller

    #247614 Reply

    Brian Fernandes
    Moderator

    David,

    When you say “specify JDBC datatype for every field”. I assume you’re referring to page 3 of the wizard? In any case, you shouldn’t have to do this at all. Could you try switching beween Java Types and Hibernate Types on page 2 and see if that fixes things for you?

    If the mapping does not run, can you give us details of what exactly is going wrong in this case? Do you have a stack trace in the error log which you can paste here? Also mention which driver you are using to connect.

    Further instructions here: Posting Guidelines
    Best,
    Brian.

    #247620 Reply

    jarethk
    Member

    Switching to the Hibernate Types helps some, but our coding standards are to use the Java types.

    FYI, I’m using Hibernate 2.1

    I’m also missing other “features” from the older version.

    In the older version it would auto-detect foreign keys and set them as many-to-one associations. It just leaves it as a long now, leaving me to track them down and put in the associations myself.

    Also, with numeric fields the new version creates a <column> element with precision and scale attributes. Those attributes aren’t specified in the 2.0 dtd.

    When I reverse engineer into a project specifying a DataSource in the hibernate.cfg.xml it fails to do the code generation, and the following is in the .log file:
    !ENTRY org.hibernate.eclipse 4 50000 2006-03-02 09:00:26.817
    !MESSAGE FATAL Worker-16 org.hibernate.connection.DatasourceConnectionProvider – Could not find datasource: ClaimsDataSource
    !STACK 0
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
    at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1855)
    at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:68)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$5.execute(GenerateArtifactsJob.java:393)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
    at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:388)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:255)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)

    I’ve downgraded back to 3.8.4 for when I have to reverse engineer tables to hibernate. When the above issues are resolved I might consider upgrading again.

    — David F.

    ps. your Help documentation looks like the 3.8.x version of the reverse-engineering utility.

    #247622 Reply

    Brian Fernandes
    Moderator

    David,

    Yes, the documentation always lags and it’s almost there. Sorry about that.

    4.1.1 will be released very soon, perhaps today. The foreign key and the datasource problem have been fixed in this release, we’d be happy if you can test that and see if works for you.
    In 4.1.0 you would have to select all the tables involved in a relationship for reverse engineering to have the m2o mappings generated

    I understand the issue about attributes unsupported in Hibernate 2 being generated, because the RE is mostly Hibernate 3 centric. However, it is possible to stop most of these attributes from being generated using custom templates, we can walk you through that process when 4.1.1 is released.

    Sorry for the inconvenience caused,
    Best,
    Brian.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Hibernate issues in 4.1.0

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