openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: orm.xml|discriminator-column|strange column
Date Tue, 26 Jan 2010 15:21:51 GMT
Hi,
I'm not sure what this posting was supposed to indicate...  As I look at
your table creation statements, it doesn't look like you followed my earlier
advice.  That is, I still see where you are trying to have the discriminator
column (p_type) be a two character field:

executing stmnt 10140905 CREATE TABLE park.person (id_person INTEGER NOT
NULL, address VARCHAR(100), name VARCHAR(100), p_type CHAR(2), version
INTEGER, PRIMARY KEY (id_person))

You either need to change this to a single Character or a String.

Kevin


On Tue, Jan 26, 2010 at 9:00 AM, gilbertoca <gilbertoca@gmail.com> wrote:

>
> Testing on Postgresql 8.3
>
> OpenJpa property:
>
> buildSchema(SchemaAction='drop,add',primaryKeys=true,foreignKeys=true,indexes=true)
>
> First run:
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running park.model.LegalEntityTest
> 792  parkPU  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded the
> class enhancer. Any classes that were not enhanced at build time will be
> enhanced when they are loaded by the JVM.
> 927  parkPU  INFO   [main] openjpa.Runtime - Starting OpenJPA 2.0.0-M3
> 1939  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 17605128>
> executing prepstmnt 1340650 SELECT NULL AS SEQUENCE_SCHEMA, relname AS
> SEQUENCE_NAME FROM pg_class WHERE relkind='S'
> 1944  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 17605128>
> [5 ms] spent
> 2025  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 2216507>
> executing prepstmnt 173823 SELECT NULL AS SEQUENCE_SCHEMA, relname AS
> SEQUENCE_NAME FROM pg_class WHERE relkind='S'
> 2028  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 2216507>
> [3
> ms] spent
> 2064  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 19256862>
> executing stmnt 29616570 CREATE TABLE park.legal_entity (id_person INTEGER
> NOT NULL, dt_foundation DATE, taxpayers_id VARCHAR(20), PRIMARY KEY
> (id_person))
> 2078  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 19256862>
> [14 ms] spent
> 2086  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 28939486>
> executing stmnt 22401955 CREATE TABLE park.natural_person (id_person
> INTEGER
> NOT NULL, dt_birth DATE, legal_document VARCHAR(20), PRIMARY KEY
> (id_person))
> 2097  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 28939486>
> [11 ms] spent
> 2105  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 18972263>
> executing stmnt 5760903 CREATE TABLE park.OPENJPA_SEQUENCE_TABLE (ID
> SMALLINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID))
> 2130  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 18972263>
> [18 ms] spent
> 2144  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 19459570>
> executing stmnt 30836417 CREATE TABLE park.person (id_person INTEGER NOT
> NULL, address VARCHAR(100), name VARCHAR(100), p_type CHAR(2), version
> INTEGER, PRIMARY KEY (id_person))
> 2158  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 19459570>
> [13 ms] spent
> 2168  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 8079107>
> executing stmnt 13101223 CREATE INDEX I_PERSON_DTYPE ON park.person
> (p_type)
> 2181  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 8079107>
> [13 ms] spent
> 3300  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 28681679>
> executing prepstmnt 24374438 SELECT t1.id_person, t1.p_type, t1.version,
> t1.address, t1.name, t0.dt_foundation, t0.taxpayers_id FROM
> park.legal_entity t0 INNER JOIN park.person t1 ON t0.id_person =
> t1.id_person WHERE t1.p_type = ? [params=(int) 76]
> 3305  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 28681679>
> [5 ms] spent
> 2010-01-26 11:50:37,874 [main] DEBUG park.model.LegalEntityTest -
> Getting an Legal Person by ID.
>
> 3447  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 23903639>
> executing prepstmnt 15198443 SELECT t1.p_type, t1.version, t1.address,
> t1.name, t0.dt_foundation, t0.taxpayers_id FROM park.legal_entity t0 INNER
> JOIN park.person t1 ON t0.id_person = t1.id_person WHERE t1.p_type = ? AND
> t0.id_person = ? [params=(int) 76, (int) 1002]
> 3452  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 23903639>
> [5 ms] spent
> Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 4.009 sec
> <<< FAILURE!
> Running park.model.NaturalPersonTest
> 1  parkPU  INFO   [main] openjpa.Runtime - Starting OpenJPA 2.0.0-M3
> 293  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 23480987>
> executing prepstmnt 29744595 SELECT NULL AS SEQUENCE_SCHEMA, relname AS
> SEQUENCE_NAME FROM pg_class WHERE relkind='S'
> 296  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 23480987>
> [3
> ms] spent
> 589  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 23247513>
> executing stmnt 28349058 DROP TABLE park.legal_entity
> 597  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 23247513>
> [8
> ms] spent
> 605  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 28816391>
> executing stmnt 13158358 DROP TABLE park.natural_person
> 613  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 28816391>
> [8
> ms] spent
> 621  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 9027862>
> executing stmnt 25976423 DROP TABLE park.person
> 631  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 9027862>
> [10
> ms] spent
> 693  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 4273072>
> executing prepstmnt 31701975 SELECT NULL AS SEQUENCE_SCHEMA, relname AS
> SEQUENCE_NAME FROM pg_class WHERE relkind='S'
> 696  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 4273072> [3
> ms] spent
> 817  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 26269921>
> executing stmnt 11037970 CREATE TABLE park.legal_entity (id_person INTEGER
> NOT NULL, dt_foundation DATE, taxpayers_id VARCHAR(20), PRIMARY KEY
> (id_person))
> 830  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 26269921>
> [13 ms] spent
> 839  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 20295294>
> executing stmnt 21153656 CREATE TABLE park.natural_person (id_person
> INTEGER
> NOT NULL, dt_birth DATE, legal_document VARCHAR(20), PRIMARY KEY
> (id_person))
> 851  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 20295294>
> [12 ms] spent
> 859  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 15245517>
> executing stmnt 10140905 CREATE TABLE park.person (id_person INTEGER NOT
> NULL, address VARCHAR(100), name VARCHAR(100), p_type CHAR(2), version
> INTEGER, PRIMARY KEY (id_person))
> 903  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 15245517>
> [44 ms] spent
> 912  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 5700630>
> executing stmnt 7730615 CREATE INDEX I_PERSON_DTYPE ON park.person (p_type)
> 920  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 5700630> [8
> ms] spent
> 2010-01-26 11:50:39,050 [main] DEBUG park.model.NaturalPersonTest -
> Getting an Natural Person by ID.
>
> 1097  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 11019994>
> executing prepstmnt 15624918 SELECT t1.p_type, t1.version, t1.address,
> t1.name, t0.dt_birth, t0.legal_document FROM park.natural_person t0 INNER
> JOIN park.person t1 ON t0.id_person = t1.id_person WHERE t1.p_type = ? AND
> t0.id_person = ? [params=(int) 78, (int) 1000]
> 1102  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 11019994>
> [4 ms] spent
> 1172  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 14519821>
> executing prepstmnt 23053938 SELECT t1.id_person, t1.p_type, t1.version,
> t1.address, t1.name, t0.dt_birth, t0.legal_document FROM
> park.natural_person
> t0 INNER JOIN park.person t1 ON t0.id_person = t1.id_person WHERE t1.p_type
> = ? [params=(int) 78]
> 1177  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 17284365, conn 14519821>
> [5 ms] spent
> Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.231 sec
> <<< FAILURE!
>
> Results :
>
> Tests in error:
>  findAll(park.model.LegalEntityTest)
>  GetLegalEntityById(park.model.LegalEntityTest)
>  getNaturalPersonById(park.model.NaturalPersonTest)
>  findAll(park.model.NaturalPersonTest)
>
> Tests run: 4, Failures: 0, Errors: 4, Skipped: 0
>
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
>
> The error:
> gilberto@SUGEP-DMASI:~/dev/netbeans-config/park-jpa/core> cat
>
> /home/gilberto/dev/netbeans-config/park-jpa/core/target/surefire-reports/park.model.LegalEntityTest.txt
>
> -------------------------------------------------------------------------------
> Test set: park.model.LegalEntityTest
>
> -------------------------------------------------------------------------------
> Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 4.01 sec
> <<<
> FAILURE!
> findAll(park.model.LegalEntityTest)  Time elapsed: 0.806 sec  <<< ERROR!
> <openjpa-2.0.0-M3-r422266:822833 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: ERRO: operador não
> existe: character = integer {prepstmnt 24374438 SELECT t1.id_person,
> t1.p_type, t1.version, t1.address, t1.name, t0.dt_foundation,
> t0.taxpayers_id FROM park.legal_entity t0 INNER JOIN park.person t1 ON
> t0.id_person = t1.id_person WHERE t1.p_type = ? [params=(int) 76]} [code=0,
> state=42883]
>        at
> org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4590)
>        at
>
> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4543)
>        at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
>        at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
>        at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
>        at
>
> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheckedException(SelectResultObjectProvider.java:155)
>        at
> org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:40)
>        at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1239)
>        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1000)
>        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:856)
>        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:787)
>        at
> org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
>        at
> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:291)
>        at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:303)
>        at park.model.LegalEntityTest.findAll(LegalEntityTest.java:97)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
>
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>        at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>        at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>        at
>
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>        at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>        at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>        at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
>        at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
>        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
>        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>        at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
>        at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>        at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>        at
>
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>        at
>
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>        at
>
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
>
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>        at
>
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: ERRO:
> operador
> não existe: character = integer {prepstmnt 24374438 SELECT t1.id_person,
> t1.p_type, t1.version, t1.address, t1.name, t0.dt_foundation,
> t0.taxpayers_id FROM park.legal_entity t0 INNER JOIN park.person t1 ON
> t0.id_person = t1.id_person WHERE t1.p_type = ? [params=(int) 76]} [code=0,
> state=42883]
>        at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:254)
>        at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:70)
>        at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1053)
>        at
>
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:278)
>        at
>
> org.apache.openjpa.jdbc.sql.PostgresDictionary$PostgresPreparedStatement.executeQuery(PostgresDictionary.java:723)
>        at
>
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:278)
>        at
>
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1621)
>        at
>
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:268)
>        at
> org.apache.openjpa.jdbc.sql.SelectImpl.executeQuery(SelectImpl.java:470)
>        at
> org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:395)
>        at
> org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:363)
>        at
>
> org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:427)
>        at
> org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:230)
>        at
> org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:220)
>        at
>
> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
>        at
> org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:34)
>        ... 36 more
> --
> View this message in context:
> http://n2.nabble.com/orm-xml-discriminator-column-strange-column-tp4455011p4461052.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message