Search code examples
javaeclipsejpaeclipselink

JPA Eclipse "Generating Tables From Entities" hangs forever


On a Windows 8 64bit machine, in Eclipse Luna, I use JPA (EclipseLink 2.5.x) and Apache Derby as JDBC connection.

My persistence.xml so far:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="ReportWriter" transaction-type="RESOURCE_LOCAL">
        <class>com.example.Clazz</class>
        <class>com.example.CommentBank</class>
        <class>com.example.CommentCategory</class>
        <class>com.example.CourseWork</class>
        <class>com.example.GradeModel</class>
        <class>com.example.Pupil</class>
        <class>com.example.PupilCoursework</class>
        <class>com.example.Report</class>
        <class>com.example.Year</class>
        <properties>
            <property name="javax.persistence.jdbc.url" value="jdbc:derby:D:\rwdb.db"/>
            <property name="javax.persistence.jdbc.user" value="rwdbuser"/>
            <property name="javax.persistence.jdbc.password" value="rwdbpassword"/>
            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
            <property name="eclipselink.jdbc.exclusive-connection.is-lazy" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

Using the wizard, I created a new database connection in Eclipse which works pretty well.

When I want to do JPA Tools => Generate Tables From Entities, eclipse starts creating tables... and continues forever. There's no exception, no other message, it just blocks on this operation.

I cannot even cancel it. If I try to do so, it just adds "Cancel requested" to the item and keeps going. Closing eclipse isn't possible either, as it's awaiting the finish of its current operations.

.metadata\.log doesn't contain any new information about this.

Oh and I chose "sql-script" as output, just in case.

Any ideas?


Solution

  • The classes that should be generated already have to be listed in persistence.xml. Once I did this, it worked.