|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
The Java type [null] is not a valid database type -- any clues?I've gotten this error while marking up some Entities and running them through unit tests. Both Hibernate and OpenJPA deal with my setup just fine, but it looks like at EntityManagerFactory creation time, EclipseLink barfs with this error. I've reproduced the stack below.
This appears to happen as a side effect of relying on EclipseLink's DDL-generation; I have that property set to drop-and-create-tables. Exception Description: The Java type [null] is not a valid database type. at org.eclipse.persistence.exceptions.ValidationException.javaTypeIsNotAValidDatabaseType(ValidationException.java:1172) at org.eclipse.persistence.tools.schemaframework.FieldDefinition.appendDBString(FieldDefinition.java:137) at org.eclipse.persistence.tools.schemaframework.TableDefinition.buildCreationWriter(TableDefinition.java:306) at org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.createOnDatabase(DatabaseObjectDefinition.java:81) at org.eclipse.persistence.tools.schemaframework.SchemaManager.createObject(SchemaManager.java:187) at org.eclipse.persistence.tools.schemaframework.SchemaManager.replaceObject(SchemaManager.java:882) at org.eclipse.persistence.tools.schemaframework.TableCreator.replaceTablesAndConstraints(TableCreator.java:297) at org.eclipse.persistence.tools.schemaframework.TableCreator.replaceTables(TableCreator.java:260) at org.eclipse.persistence.tools.schemaframework.SchemaManager.replaceDefaultTables(SchemaManager.java:944) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.createOrReplaceDefaultTables(EntityManagerFactoryProvider.java:78) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.writeDDLToDatabase(EntityManagerFactoryProvider.java:286) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.generateDDL(EntityManagerFactoryProvider.java:115) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:260) I've turned logging up to FINEST, and here is all I get (stand back; I've trimmed some of the "connecting"-type messages for some degree of brevity): [EL Finest]: 2009-06-29 12:02:40.796--ServerSession(14738709)--Thread(Thread[main,5,main])--Begin predeploying Persistence Unit test-EclipseLink; state Predeployed; factoryCount 0 [EL Finest]: 2009-06-29 12:02:40.796--ServerSession(14738709)--Thread(Thread[main,5,main])--End predeploying Persistence Unit test-EclipseLink; state Predeployed; factoryCount 1 [EL Finest]: 2009-06-29 12:02:40.796--ServerSession(14738709)--Thread(Thread[main,5,main])--Begin deploying Persistence Unit test-EclipseLink; state Predeployed; factoryCount 1 [EL Finest]: 2009-06-29 12:02:40.828--ServerSession(14738709)--Thread(Thread[main,5,main])--property=eclipselink.logging.level; value=FINEST; translated value=FINEST [EL Finest]: 2009-06-29 12:02:40.828--ServerSession(14738709)--Thread(Thread[main,5,main])--property=eclipselink.logging.level; value=FINEST; translated value=FINEST [EL Finest]: 2009-06-29 12:02:40.828--ServerSession(14738709)--Thread(Thread[main,5,main])--property=eclipselink.jdbc.user; value=sa [EL Finest]: 2009-06-29 12:02:40.828--ServerSession(14738709)--Thread(Thread[main,5,main])--property=eclipselink.jdbc.password; value=xxxxxx [EL Finest]: 2009-06-29 12:02:41.578--ServerSession(14738709)--Thread(Thread[main,5,main])--property=eclipselink.target-database; value=org.eclipse.persistence.platform.database.H2Platform [EL Finest]: 2009-06-29 12:02:41.578--ServerSession(14738709)--Thread(Thread[main,5,main])--property=eclipselink.jdbc.driver; value=org.h2.Driver [EL Finest]: 2009-06-29 12:02:41.578--ServerSession(14738709)--Thread(Thread[main,5,main])--property=eclipselink.jdbc.url; value=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 [EL Finest]: 2009-06-29 12:02:41.578--ServerSession(14738709)--Thread(Thread[main,5,main])--property=eclipselink.jdbc.native-sql; value=true [EL Info]: 2009-06-29 12:02:41.593--ServerSession(14738709)--Thread(Thread[main,5,main])--EclipseLink, version: Eclipse Persistence Services - 1.1.2.v20090612-r4475 [EL Config]: 2009-06-29 12:02:41.609--ServerSession(14738709)--Connection(25150543)--Thread(Thread[main,5,main])--connecting(DatabaseLogin( platform=>H2Platform user name=> "sa" datasource URL=> "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" )) [EL Config]: 2009-06-29 12:02:41.609--ServerSession(14738709)--Connection(20002533)--Thread(Thread[main,5,main])--Connected: jdbc:h2:mem:test User: SA Database: H2 Version: 1.1.114 (2009-06-01) Driver: H2 JDBC Driver Version: 1.1.114 (2009-06-01) (lots of connecting...connected messages snipped here) [EL Finest]: 2009-06-29 12:02:41.671--ServerSession(14738709)--Thread(Thread[main,5,main])--sequencing connected, state is NoPreallocation_State [EL Finest]: 2009-06-29 12:02:41.671--ServerSession(14738709)--Thread(Thread[main,5,main])--sequence SEQ_GEN_IDENTITY: preallocation size 1 [EL Info]: 2009-06-29 12:02:41.781--ServerSession(14738709)--Thread(Thread[main,5,main])--file:/e:/projects/cx-experimental/modules/glaccount/jpa/target/test-classes/-test-EclipseLink login successful [EL Finest]: 2009-06-29 12:02:41.812--ServerSession(14738709)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="ALTER TABLE doc_table DROP CONSTRAINT FK_doc_table_obj") [EL Fine]: 2009-06-29 12:02:41.812--ServerSession(14738709)--Connection(26179329)--Thread(Thread[main,5,main])--ALTER TABLE doc_table DROP CONSTRAINT FK_doc_table_obj [EL Fine]: 2009-06-29 12:02:41.812--ServerSession(14738709)--Thread(Thread[main,5,main])--CALL 42 [EL Warning]: 2009-06-29 12:02:41.812--ServerSession(14738709)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.h2.jdbc.JdbcSQLException: Table DOC_TABLE not found; SQL statement: ALTER TABLE doc_table DROP CONSTRAINT FK_doc_table_obj [42102-114] Error Code: 42102 Call: ALTER TABLE doc_table DROP CONSTRAINT FK_doc_table_obj Query: DataModifyQuery(sql="ALTER TABLE doc_table DROP CONSTRAINT FK_doc_table_obj") [EL Finest]: 2009-06-29 12:02:41.828--ServerSession(14738709)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="DROP TABLE doc_table") [EL Fine]: 2009-06-29 12:02:41.828--ServerSession(14738709)--Connection(20002533)--Thread(Thread[main,5,main])--DROP TABLE doc_table [EL Fine]: 2009-06-29 12:02:41.828--ServerSession(14738709)--Thread(Thread[main,5,main])--CALL 42 [EL Warning]: 2009-06-29 12:02:41.828--ServerSession(14738709)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.h2.jdbc.JdbcSQLException: Table DOC_TABLE not found; SQL statement: DROP TABLE doc_table [42102-114] Error Code: 42102 Call: DROP TABLE doc_table Query: DataModifyQuery(sql="DROP TABLE doc_table") [EL Severe]: 2009-06-29 12:02:41.843--ServerSession(14738709)--Thread(Thread[main,5,main])--Local Exception Stack: Exception [EclipseLink-7008] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.ValidationException Exception Description: The Java type [null] is not a valid database type. There is basically one other report, ever, of this error on the Internet, and it was never resolved. Does someone know at least where I should begin looking? Best, Laird _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: The Java type [null] is not a valid database type -- any clues?On Mon, Jun 29, 2009 at 12:44 PM, Laird Nelson <ljnelson@...> wrote: I've gotten this error while marking up some Entities and running them through unit tests. Both Hibernate and OpenJPA deal with my setup just fine, but it looks like at EntityManagerFactory creation time, EclipseLink barfs with this error. I've reproduced the stack below. Through some blind trial and error, I found where this bug is. I have one entity, call it B, that has an @EmbeddedId field that consists of four columns. I have another entity, call it A, that has a @ManyToOne relationship with B. The field in question is annotated like this: @ManyToOne private B b; If I mark this relationship instead as @Transient, the exception previously described goes away. In either case, tests run wiith Hibernate and OpenJPA pass. Any idea what's going on here? I am using EclipseLink v1.1.2-SNAPSHOT, downloaded via Maven. Thanks, Laird _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: The Java type [null] is not a valid database type -- any clues?On Mon, Jun 29, 2009 at 2:03 PM, Laird Nelson <ljnelson@...> wrote:
And that is the problem. I have not specified the full regiment of @JoinColumns. So, to recap: "Java type [null] is not a valid database type" actually means "You forgot to specify @JoinColumns on your @ManyToOne relationship." Interestingly, neither Hibernate nor OpenJPA seem to mind--who's correct here? Best, Laird _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: The Java type [null] is not a valid database type -- any clues?This error is odd, please log a detailed bug for it include the object model/annotations and the error message. The default mapping should be able to determine the column type in most cases.
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
|
|
Re: The Java type [null] is not a valid database type -- any clues?I'm now encountering it in another @ManyToOne situation where the presence or absence of @JoinColumns doesn't seem to matter. I'll definitely file a bug.
Best, Laird On Tue, Jun 30, 2009 at 12:35 PM, James Sutherland <jamesssss@...> wrote:
_______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: The Java type [null] is not a valid database type -- any clues?On Tue, Jun 30, 2009 at 12:36 PM, Laird Nelson <ljnelson@...> wrote:
I'm now encountering it in another @ManyToOne situation where the presence or absence of @JoinColumns doesn't seem to matter. I'll definitely file a bug. HA! Finally found what the issue is--it is definitely a bug. If you do a @ManyToOne relationship, where the "one" has an @Id column that contains a columnDefinition attribute, you can trigger the error. There may be additional ways to trigger it. Now that I have found it, I'll file a bug. This is a big deal for me, as we need to specify columnDefinition fragments, deeply unfortunately, for lots of legacy columns in our database (to force, for example, the use of CHAR instead of VARCHAR). Thanks, Laird _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: The Java type [null] is not a valid database type -- any clues?Bug filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=282075
I marked it as high priority; I hope that's OK. Best, Laird
On Tue, Jun 30, 2009 at 4:01 PM, Laird Nelson <ljnelson@...> wrote:
_______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
| Free embeddable forum powered by Nabble | Forum Help |