Sqlite& Hibernate Ex:否JDBC类型的Dialect映射:0
我使用自定义方言( https://code.google.com/p/hibernate -sqlite / )用于连接Sqlite和Hibernate。因为Hibernate并没有完全支持Sqlite。
Im using a custom dialect( https://code.google.com/p/hibernate-sqlite/ ) for connect Sqlite with Hibernate. Because Hibernate doesnt full support Sqlite yet.
如果我不添加以下行到 SqliteDialect
, query.list()
抛出 MappingException
If i don't add following lines to SqliteDialect
, query.list()
throwing MappingException
registerColumnType(Types.NULL, "null");
registerHibernateType(Types.NULL, "null");
我将 nullable = true
添加到我的实体@Column。
I added nullable = true
to my Entity @Column.
目前看起来不错,但是如果这个列有一个 null
值,当我调用 query.list()
,它会抛出 NullPointerException
。
That currently looking good but if this column have a null
value and When i called query.list()
, it throws NullPointerException
.
我解决这个问题。我错过了什么?谢谢!
How could I resolve this. What am I missing? Thank you in advance!
SQLite没有解决问题。但是,我目前已将H2 db集成到我的项目中。现在看起来很好。
SQLite did not solve the problem. But, I've currently integrated H2 db to my project. Thats looking fine now.