开发者

JDO cannot map java.lang.Boolean for Apache Derby

This is my first time to use Eclipse and JDO. I have a problem when using Schema Tool in Eclipse to generate DDL.

One of the fields in a Java class looks like following:

@Persistent
@Column(name = "Enabled", jdbcType = "BOOLEAN")
private boolean enabled = true;

I have enhanced the class with Enhancer Tool successfully, but when I ran the Schema Tool (with derbyclient.jar as JDBC driver), the following error message was logged:

18:47:26,164 (main) ERROR [DataNucleus.SchemaTool] - An exception was thrown during the operation of SchemaTool. Please refer to the log for full details. The following may help : JDBC type BOOLEAN declared for field "org.company.core.User.enabled" of java type java.lang.Boolean cant be mapped for this datastore. JDBC type BOOLEAN declared for field "org.company.core.User.enabled" of java type java.lang.Boolean cant be mapped for this datastore. org.datanucleus.exceptions.NucleusException: JDBC type BOOLEAN declared for field "org.company.core.User.enabled" of java type java.lang.Boolean cant be mapped for this datastore. at org.datanucleus.store.rdbms.mapping.RDBMSMappingManager.getDatastoreMappingClass(RDBMSMappingManager.java:329) at org.datanucleus.store.rdbms.mapping.RDBMSMappingManager.createDatastoreMapping(RDBMSMappingManager.java:533) at org.datanucleus.store.mapped.mapping.SingleFieldMapping.prepareDatastoreMapping(SingleFieldMapping.java:55) at org.datanucleus.store.mapped.mapping.SingleFieldMapping.initialize(SingleFieldMapping.java:44) at org.datanucleus.store.mapped.mapping.MappingFactory.createMapping(MappingFactory.java:97) at org.datanucleus.store.mapped.mapping.AbstractMappingManager.getMapping(AbstractMappingManager.java:255) at org.datanucleus.store.rdbms.table.ClassTable.manageMembers(ClassTable.java:571) at org.datanucleus.store.rdbms.table.ClassTable.manageClass(ClassTable.java:451) at org.datanucleus.store.rdbms.table.ClassTable.initializeForClass(ClassTable.java:1111) at org.datanucleus.store.rdbms.table.ClassTable.initialize(ClassTable.java:268) at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.initializeClassTables(RDBMSStoreManager.java:2439) at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.addClassTablesAndValidate(RDBMSStoreManager.java:2346) at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:1996) at org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:113) at org.datanucleus.store.rdbms.RDB开发者_开发百科MSStoreManager.createSchema(RDBMSStoreManager.java:3114) at org.datanucleus.store.schema.SchemaTool.createSchema(SchemaTool.java:443) at org.datanucleus.store.schema.SchemaTool.main(SchemaTool.java:378)

I have checked the manual of Apache Derby, the database supports BOOLEAN data type: http://db.apache.org/derby/docs/10.8/ref/rrefsqljBoolean.html

What would be the cause of the error?

Thanks in advance.


DataNucleus works fine for persisting boolean Java fields to BOOLEAN jdbcType for me; using DataNucleus 3.x and Derby 10.7.1.1.

The DataNucleus log tells you clearly what JDBC types are actually supported by that release of Derby (i.e what Derby claims to support via JDBC calls - what the manual says isn't necessarily the same).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜