Hello,
I am trying to get the EclipseLink metamodel generator working from within Eclipse. To do this, I have enabled annotation processing in the Java compiler options and added the following JARs:
- eclipselink-jpa-modelgen_2.1.2.v20101206-r8635.jar
- javax.persistence_2.0.1.v201006031150.jar
- eclipselink.jar
Eclipse generates a folder for the generated source code in the project folder (called "generated" -- I changed this from the default) but no classes inside that folder.
Thanks in advance for any help.
Code for the entity class:
/**
* Copyright (c) 2010 Martin Geisse
*
* This file is distributed under the terms of the MIT license.
*/
package name.martingeisse.leckermittag.experiment;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
* A simple test entity for EclipseLink experiments.
*/
@Entity
public class Todo {
/**
* the id
*/
private Long id;
/**
* the summary
*/
private String summary;
/**
* the description
*/
private String description;
/**
* Constructor.
*/
public Todo() {
}
/**
* Getter method for the id.
* @return the id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return id;
}
/**
* Setter method for the id.
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* Getter method for the summary.
* @return the summary
*/
public String getSummary() {
return summary;
}
/**
* Setter method for the summary.
* @param summary the summary to set
*/
public void setSummary(String summary) {
this.summary = summary;
}
/**
* Getter method for the description.
* @return the description
*/
public String getDescription() {
return description;
}
/**
* Setter method for the description.
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "Todo [summary=" + summary + ", description=" + description + "]";
}
}
(project)/src/META-INF/persistence.xml
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="todos" transaction-type="RESOURCE_LOCAL">
<class>name.martingeisse.leckermittag.experiment.Todo</class>
<properties>
<!-- <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" /> -->
<!-- <property name="javax.persistence.jdbc.url" value="jdbc:derby:/home/vogella/databases/simpleDb;create=true" /> -->
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/leckerMittag" />
<property name="javax.persistence.jdbc.user" value="postgres" />
<property name="javax.persistence.jdbc.password" value="postgres" />
<!-- EclipseLink should create the database schema automatically -->
<!-- <property name="eclipselink.ddl-generation" value="create-tables" /> -->
<!-- <property name="eclipselink.ddl-generation.output-mode" value="database" /> -->
</properties>
</persistence-unit>
</persistence>
(project)/src/META-INF/orm.xml
<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd">
<description>description here</description>
<persistence-unit-metadata>
<persistence-unit-defaults>
<delimited-identifiers />
</persistence-unit-defaults>
</persistence-unit-metadata>
</entity-mappings>