You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Albert Lee (JIRA)" <ji...@apache.org> on 2015/05/20 00:43:00 UTC

[jira] [Created] (OPENJPA-2588) Entity attribute using keyword as name failed on Mapping tool even name is quoted using @Column(name="\"GROUP\"")

Albert Lee created OPENJPA-2588:
-----------------------------------

             Summary: Entity attribute using keyword as name failed on Mapping tool even name is quoted using @Column(name="\"GROUP\"")
                 Key: OPENJPA-2588
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2588
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 2.4.0, 2.3.0, 2.2.2
            Reporter: Albert Lee


Have a entity using keyword as attribute name but overridden with @Column to quote the keyword as in:

@Entity
public class KeyWord { .....
	@Column(name="\"GROUP\"")
	private String group;
}

The first time createEmf and createEm create the table with proper column name (i.e. GROUP).  When the second time (table already existed) the same test case is run, the following exception is thrown.

1310  TRACE  [main] openjpa.jdbc.SQL - <t 706835911, conn 352584430> executing stmnt 1628232398 ALTER TABLE KeyWord ADD "GROUP" VARCHAR(255)
1341  TRACE  [main] openjpa.jdbc.SQL - <t 706835911, conn 352584430> [31 ms] spent
Exception in thread "main" <openjpa-2.2.3-SNAPSHOT-r422266:1595313 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: Column 'GROUP' already exists in Table/View '"APP"."KEYWORD"'. {stmnt 1628232398 ALTER TABLE KeyWord ADD "GROUP" VARCHAR(255)} [code=30000, state=X0Y32]
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:160)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
	at com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:51)
	at com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:35)
	at test.Main.main(Main.java:16)
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Column 'GROUP' already exists in Table/View '"APP"."KEYWORD"'. {stmnt 1628232398 ALTER TABLE KeyWord ADD "GROUP" VARCHAR(255)} [code=30000, state=X0Y32]
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:219)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:203)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:59)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:914)
	at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:118)
	at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1224)
	at org.apache.openjpa.jdbc.schema.SchemaTool.addColumn(SchemaTool.java:1057)
	at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:506)
	at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:366)
	at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:343)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:505)
	... 10 more



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)