Kevin Sutter wrote:
> 
> 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.  
> 
Sorry!
I've posted one try with Postgresql before doing you suggestion, but it
should be the one with right changes!


Kevin Sutter wrote:
> 
> 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.
> 

Using this one:

<discriminator-column name="p_type" column-definition="CHAR(2)" length="2"
discriminator-type="STRING"/>
, my test passes. (H2 and Postgresql)

This one:


> <discriminator-column name="p_type" column-definition="CHAR(1)"
> discriminator-type="CHAR"/>
> <discriminator-value>N</discriminator-value>
> <discriminator-value>L</discriminator-value>
> 

I do get these errors:


-------------------------------------------------------
 T E S T S                                             
-------------------------------------------------------
Running park.model.LegalEntityTest                     
768  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.                                       
                                                 
830  parkPU  INFO   [main] openjpa.Runtime - Starting OpenJPA 2.0.0-M3          
                                                           
1887  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 40717>
executing prepstmnt 28732166 SELECT NULL AS SEQUENCE_SCHEMA, relname AS
SEQUENCE_NAME FROM pg_class WHERE relkind='S'                                   
                                                      
1891  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 40717> [4
ms] spent                                                       
2248  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 14456678>
executing stmnt 28939486 DROP TABLE park.legal_entity           
2258  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 14456678>
[10 ms] spent                                                   
2266  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 18972263>
executing stmnt 5760903 DROP TABLE park.natural_person          
2275  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 18972263>
[8 ms] spent                                                    
2283  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 30836417>
executing stmnt 32619928 DROP TABLE park.person                 
2293  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 30836417>
[10 ms] spent                                                   
2350  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 1957306>
executing prepstmnt 19459570 SELECT NULL AS SEQUENCE_SCHEMA, relname AS
SEQUENCE_NAME FROM pg_class WHERE relkind='S'                                   
                                                    
2353  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 1957306> [3
ms] spent                                                     
2479  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 8079107>
executing stmnt 13101223 CREATE TABLE park.legal_entity (id_person INTEGER
NOT NULL, dt_foundation DATE, taxpayers_id VARCHAR(20), PRIMARY KEY
(id_person))                                                 
2505  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 8079107>
[26 ms] spent                                                    
2514  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 29656818>
executing stmnt 15284633 CREATE TABLE park.natural_person (id_person INTEGER
NOT NULL, dt_birth DATE, legal_document VARCHAR(20), PRIMARY KEY
(id_person))                                                 
2526  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 29656818>
[12 ms] spent                                                   
2537  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 18158190>
executing stmnt 6824966 CREATE TABLE park.person (id_person INTEGER NOT
NULL, address VARCHAR(100), name VARCHAR(100), p_type CHAR(1), version
INTEGER, PRIMARY KEY (id_person))                           
2561  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 18158190>
[24 ms] spent                                                   
2587  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 10141941>
executing stmnt 18423897 CREATE INDEX I_PERSON_DTYPE ON park.person (p_type)    
                                                                                
                                           
2595  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 10141941>
[7 ms] spent                                                    
3768  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 7962652>
executing prepstmnt 12254719 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]                              
                                                                 
3773  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 7962652> [5
ms] spent                                                     
2010-01-26 14:38:54,258 [main] DEBUG park.model.LegalEntityTest -               
                                                           
Getting an Legal Person by ID.                                                  
                                                           

3918  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 1253877>
executing prepstmnt 23903639 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]                                  
                                          
3923  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 1253877> [5
ms] spent                                                     
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 4.439 sec
<<< FAILURE!                                                     
Running park.model.NaturalPersonTest                                            
                                                           
1  parkPU  INFO   [main] openjpa.Runtime - Starting OpenJPA 2.0.0-M3            
                                                           
270  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 11273940>
executing prepstmnt 23480987 SELECT NULL AS SEQUENCE_SCHEMA, relname AS
SEQUENCE_NAME FROM pg_class WHERE relkind='S'                                   
                                                    
273  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 11273940> [3
ms] spent                                                     
565  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 13158358>
executing stmnt 23247513 DROP TABLE park.legal_entity            
573  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 13158358> [8
ms] spent                                                     
581  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 25976423>
executing stmnt 28816391 DROP TABLE park.natural_person          
590  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 25976423> [8
ms] spent                                                     
597  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 31701975>
executing stmnt 9027862 DROP TABLE park.person                   
608  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 31701975>
[11 ms] spent                                                    
664  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 11037970>
executing prepstmnt 4273072 SELECT NULL AS SEQUENCE_SCHEMA, relname AS
SEQUENCE_NAME FROM pg_class WHERE relkind='S'                                   
                                                     
668  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 11037970> [3
ms] spent                                                     
780  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 9350660>
executing stmnt 26269921 CREATE TABLE park.legal_entity (id_person INTEGER
NOT NULL, dt_foundation DATE, taxpayers_id VARCHAR(20), PRIMARY KEY
(id_person))                                                  
795  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 9350660> [15
ms] spent                                                     
803  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 22221156>
executing stmnt 20295294 CREATE TABLE park.natural_person (id_person INTEGER
NOT NULL, dt_birth DATE, legal_document VARCHAR(20), PRIMARY KEY
(id_person))                                                  
825  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 22221156>
[22 ms] spent                                                    
833  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 9773403>
executing stmnt 15245517 CREATE TABLE park.person (id_person INTEGER NOT
NULL, address VARCHAR(100), name VARCHAR(100), p_type CHAR(1), version
INTEGER, PRIMARY KEY (id_person))                            
847  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 9773403> [14
ms] spent                                                     
854  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 12589033>
executing stmnt 5700630 CREATE INDEX I_PERSON_DTYPE ON park.person (p_type)     
                                                                                
                                            
877  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 12589033>
[22 ms] spent                                                    
2010-01-26 14:38:55,374 [main] DEBUG park.model.NaturalPersonTest -             
                                                           
Getting an Natural Person by ID.                                                
                                                           

1081  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 26138490>
executing prepstmnt 11019994 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]                                  
                                          
1106  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 26138490>
[25 ms] spent                                                   
1149  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 26811873>
executing prepstmnt 14519821 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]                                                           
                                    
1154  parkPU  TRACE  [main] openjpa.jdbc.SQL - <t 19699031, conn 26811873>
[5 ms] spent                                                    
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.203 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


gilbe...@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.439 sec
<<< FAILURE!                                                     
findAll(park.model.LegalEntityTest)  Time elapsed: 0.798 sec  <<< ERROR!        
                                                           
<openjpa-2.0.0-M3-r422266:822833 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: ERROR: operator does
not exist: character = integer {prepstmnt 12254719 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: ERROR:
operator does not exist: character = integer {prepstmnt 12254719 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                                                             
                                                           
NestedThrowables:                                                               
                                                           
org.postgresql.util.PSQLException: ERROR: operator does not exist: character
= integer                                                          
        at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
                                      
        at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
                                            
        at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)    
                                                
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
                                            
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
                                   
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
                                       
        at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:280)
                      
        at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1051)
                                                                                
                                       
        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)         
                      


Thanks for you attention,

Gilberto
-- 
View this message in context: 
http://n2.nabble.com/orm-xml-discriminator-column-strange-column-tp4455011p4462237.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to