mirror of
https://github.com/apache/openjpa.git
synced 2025-02-23 02:48:46 +00:00
OPENJPA-2100 fix filterPersistenceCapable
Fixing a bug which got introduced in r1091279 and caused entities which contained enums to be broken. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1224892 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
14d8109f95
commit
9f4fba24da
@ -115,6 +115,10 @@
|
|||||||
<groupId>org.apache.geronimo.specs</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>geronimo-validation_1.0_spec</artifactId>
|
<artifactId>geronimo-validation_1.0_spec</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.bval</groupId>
|
||||||
|
<artifactId>org.apache.bval.bundle</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
|
@ -20,42 +20,60 @@ package org.apache.openjpa.tools.maven.testentity;
|
|||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class TestEntity {
|
public class TestEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private int xint1;
|
private int xint1;
|
||||||
|
|
||||||
private String string1;
|
private String string1;
|
||||||
|
|
||||||
protected TestEntity() {
|
public enum SampleEnum {
|
||||||
}
|
Option1, Option2, Option3
|
||||||
|
}
|
||||||
|
|
||||||
public TestEntity(int int1, String string1) {
|
@Enumerated(EnumType.STRING)
|
||||||
this.xint1 = int1;
|
private SampleEnum myEnum;
|
||||||
this.string1 = string1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInt1() {
|
|
||||||
return xint1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInt1(int int1) {
|
protected TestEntity() {
|
||||||
this.xint1 = int1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public String getString1() {
|
public TestEntity(int int1, String string1) {
|
||||||
return string1;
|
this.xint1 = int1;
|
||||||
}
|
this.string1 = string1;
|
||||||
|
}
|
||||||
|
|
||||||
public void setString1(String string1) {
|
public int getInt1() {
|
||||||
this.string1 = string1;
|
return xint1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public void setInt1(int int1) {
|
||||||
return xint1 + ":" + string1;
|
this.xint1 = int1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getString1() {
|
||||||
|
return string1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setString1(String string1) {
|
||||||
|
this.string1 = string1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return xint1 + ":" + string1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SampleEnum getMyEnum() {
|
||||||
|
return myEnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMyEnum(SampleEnum myEnum) {
|
||||||
|
this.myEnum = myEnum;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,8 @@ public class ItDefaultSettingsTest extends TestCase {
|
|||||||
private final static String SQL_FILE = "database.sql";
|
private final static String SQL_FILE = "database.sql";
|
||||||
|
|
||||||
/** if the SQL generation has been successful, the following result should be in the SQL file */
|
/** if the SQL generation has been successful, the following result should be in the SQL file */
|
||||||
private final static String VALID_SQL = "CREATE TABLE TestEntity (xint1 INTEGER NOT NULL, string1 VARCHAR(255), PRIMARY KEY (xint1));";
|
private final static String VALID_SQL = "CREATE TABLE TestEntity (xint1 INTEGER NOT NULL, myEnum VARCHAR(20), "
|
||||||
|
+ "string1 VARCHAR(255), PRIMARY KEY (xint1));";
|
||||||
|
|
||||||
private final static String TEST_ENTITY_CLASS = "org.apache.openjpa.tools.maven.testentity.TestEntity";
|
private final static String TEST_ENTITY_CLASS = "org.apache.openjpa.tools.maven.testentity.TestEntity";
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
<table name="TestEntity">
|
<table name="TestEntity">
|
||||||
<pk column="xint1"/>
|
<pk column="xint1"/>
|
||||||
<column name="xint1" type="integer" not-null="true"/>
|
<column name="xint1" type="integer" not-null="true"/>
|
||||||
|
<column name="myEnum" type="varchar" size="20"/>
|
||||||
<column name="string1" type="varchar" size="255"/>
|
<column name="string1" type="varchar" size="255"/>
|
||||||
</table>
|
</table>
|
||||||
</schema>
|
</schema>
|
||||||
</schemas>
|
</schemas>
|
||||||
|
@ -22,6 +22,7 @@ package org.apache.openjpa.tools.maven;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@ -130,8 +131,11 @@ public abstract class AbstractOpenJpaMappingToolMojo extends AbstractOpenJpaMojo
|
|||||||
MetaDataRepository repo = conf.newMetaDataRepositoryInstance();
|
MetaDataRepository repo = conf.newMetaDataRepositoryInstance();
|
||||||
ClassArgParser cap = repo.getMetaDataFactory().newClassArgParser();
|
ClassArgParser cap = repo.getMetaDataFactory().newClassArgParser();
|
||||||
|
|
||||||
for(File classPath : files) {
|
Iterator<File> fileIt = files.iterator();
|
||||||
Class<?>[] classes = cap.parseTypes(classPath.getAbsolutePath());
|
while (fileIt.hasNext()) {
|
||||||
|
File classPath = fileIt.next();
|
||||||
|
|
||||||
|
Class[] classes = cap.parseTypes(classPath.getAbsolutePath());
|
||||||
|
|
||||||
if (classes == null) {
|
if (classes == null) {
|
||||||
getLog().info("Found no classes for " + classPath.getAbsolutePath());
|
getLog().info("Found no classes for " + classPath.getAbsolutePath());
|
||||||
@ -146,6 +150,7 @@ public abstract class AbstractOpenJpaMappingToolMojo extends AbstractOpenJpaMojo
|
|||||||
+ PersistenceCapable.class.getName());
|
+ PersistenceCapable.class.getName());
|
||||||
} else {
|
} else {
|
||||||
getLog().debug("Removing non-entity class " + classPath);
|
getLog().debug("Removing non-entity class " + classPath);
|
||||||
|
fileIt.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user