fd8*_*8s0 5 java mysql h2 relational-database jooq
I've been using H2 on the functional tests part of a MySQL based application with Hibernate. I was finally fed up with it and I decided to usq jOOQ mostly so I could still abstract myself from the underlying database.
My problem is that I don't like this code generation thing jOOQ does at all since I'm yet to see an example with it properly set up in multiple profiles, also don't like connecting to the database as part of my build. It's overall quite a nasty set-up I don't want to spend a morning doing to realise is very horrible and I don't want it in the project.
I'm using tableByName() and fieldByName() instead which I thought was a good solution, but I'm getting problems with H2 putting everything in uppercase.
If I do something like Query deleteInclusiveQuery = jooqContext.delete(tableByName("inclusive_test"))...
I get table inclusive_test not found. Note this has nothing to do with the connection delay or closing configuration.
I tried changing the connection to use ;DATABASE_TO_UPPER=false
but then I get field not found (I thought it would translate all schema).
I'm not sure if H2 is either unable to create non-upper cased schemas or I'm failing at that. If the former then I'd expect jOOQ to also upper case the table and field names in the query.
example output is:
delete from "inclusive_test" where "segment_id" in (select "id" from "segment" where "external_taxonomy_id" = 1)
which would be correct if H2 schema would have not been created like this, however the query I'm creating the schema with specifically puts it in lowercase, yet in the end it ends up being upper cased, which Hibernate seems to understand or solve, but not jOOQ
Anyway, I'm asking if there is a solution because I'm quite disappointed at the moment and I'm considering just dropping the tests where I can't use Hibernate.
Any solution that is not using the code generation feature is welcome.
我的问题是我不喜欢jOOQ所做的代码生成事情,因为我还没有看到它在多个配置文件中正确设置的示例,也不喜欢作为我的构建的一部分连接到数据库.这总体上是一个非常讨厌的设置,我不花一个上午的时间来实现是非常可怕的,我不希望它在项目中.
如果你这样做,你会错过很多令人敬畏的jOOQ功能.请参阅这个非常有趣的讨论,了解为什么在构建中使用DB连接并不是那么糟糕:
无论如何,不要太快受挫.事情已经完成的原因有几个原因.DSL.fieldByName()
创建一个区分大小写的列.如果您提供小写"inclusive_test"
列,则jOOQ将使用引号呈现名称,默认情况下使用小写.
你有几个选择:
`inclusive_test`
在MySQL和"inclusive_test"
H2中.RenderNameStyle.AS_IS
DSL.field()
而DSL.fieldByName()
不是使用.它将允许您完全控制SQL字符串.顺便说一句,我认为我们将更改手册以建议使用DSL.field()
而不是DSL.fieldByName()
新用户.整个案例敏感性在过去引起了太多问题.这将通过问题#3218完成
归档时间: |
|
查看次数: |
1347 次 |
最近记录: |