facebook

JPA npe generating artifacts on many to many

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

    DIS
    Member

    I’m using JPA with MySql and toplink. When I try to ‘generate entities and daos’ i get the following error. I’m using a pulse config ‘MyEclipse 6.5 – Pulse Edition’ if that helps any. I was running this with success until I made changes to my db structure. I am using a link table to implement a many to many between to of my tables. I think I’ve named things according to the JSR 220: Enterprise JavaBeansTM,Version 3.0 Java Persistence API specification. That was when the trouble began. Any ideas?

    Also, what is the easiest way to change my config to use hibernate with my jpa instead of toplink? I can’t see for looking.

    Thanks

    !ENTRY org.eclipse.core.jobs 4 2 2008-08-10 02:26:30.625
    !MESSAGE An internal error occurred during: “Generating Artifacts”.
    !STACK 0
    java.lang.NullPointerException
    at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:77)
    at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73)
    at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1263)
    at org.hibernate.cfg.JDBCMetaDataConfiguration.secondPassCompileForeignKeys(JDBCMetaDataConfiguration.java:33)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1170)
    at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$7.execute(GenerateArtifactsJob.java:878)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
    at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:91)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:858)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:405)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

    #288091 Reply

    DIS
    Member

    Ok, I have it working but I think the npe should not happen and yes I know it is coming from hibernate.

    There were a number of things I had to do.
    -) The two tables in the manytomany had to have foreign keys specified using the referrer table
    -) The referrer table itself had to have a primary key
    -) I had to manually remove obsolete entries from persistence.xml

    Maybe that will help someone else

    #288113 Reply

    Loyal Water
    Member

    Thank you for posting this information Im sure it would be helpful to the other users facing similar issues on the forums.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: JPA npe generating artifacts on many to many

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