Comments (10)
You cannot pass a condition to Factory.nullIf(). As specified in the MySQL docs, both arguments have to be expressions (i.e. org.jooq.Field, or T, which is any value that can be passed to Factory.val()). In jOOQ, a condition is not an expression/field
How are you calling nullif() ?
Maybe it would make sense to extend jOOQ in a way to allow org.jooq.Condition to be used as a Field across the API?
from jooq.
Ah ok, that must be why. Yes, being able to "cast" Conditions as a Field would be handy!
from jooq.
OK, that idea will be tracked as:
#1178
It might mean substantial change, as a lot of new integration tests would be needed, so I can't promise when this will be done.
Cheers
Lukas
from jooq.
Ok sure. My work-around was to simply drop down to raw SQL, which wasn't too bad.
This often comes up when you want to count rows that match a certain condition. COUNT(NULLIF([condition], false)) is a handy way to do so, but maybe I could use a case(?)
from jooq.
Yes, a CASE expression would be the most SQL-like style:
SUM(CASE WHEN [condition] THEN 1 ELSE 0 END)
I tend to feel that the NULLIF construct is a bit less readable. But I'm not so used to MySQL, so maybe it's common practice there? Still, it's a good use case for #1178
from jooq.
Oh yeah, not sure why I didn't do it that way -- I'll try it out tomorrow.
from jooq.
Worked great of course. Cheers!
from jooq.
Glad it works!
I allowed myself to cite your nice feedback from Stack Overflow directly on my blog, if that is OK with you?
http://lukaseder.wordpress.com/2012/03/02/jooq-compared-to-ibatis/
from jooq.
Sure, feel free to use the second comment too. I've been meaning to write a more thorough testimonial if that would be useful.
from jooq.
Yes, any success story (e.g. on your personal / company blog) is very welcome! If you have the time, I'd be interested in a more detailed pro / con comparison between jOOQ / iBATIS for your specific use case. Such a comparison could be a base for further discussion and feature requests in jOOQ...
Cheers
Lukas
from jooq.
Related Issues (20)
- BlobBinding and ClobBinding should fall back to byte[] and String binding also in HANA - Merge [#16646]
- Add HanaDatabase queries to MetaSQL in order to look up certain objects via DSLContext.meta()
- Add Row2.contains(Row2) HOT 1
- Generated sequences shouldn't be typed BIGINT by default, if MAXVALUE is larger than Long.MAX_VALUE
- TableRecords should refresh() themselves for HANA dialect, when any non-identity value should be fetched after an insert HOT 1
- TableRecords should refresh() themselves for HANA dialect, when any non-identity value should be fetched after an insert - Merge [#16651]
- TableRecords should refresh() themselves for HANA dialect, when any non-identity value should be fetched after an insert - Merge [#16651]
- TableRecords should refresh() themselves for HANA dialect, when any non-identity value should be fetched after an insert - Merge [#16651]
- Missing configuration in Multiset HOT 1
- Improve warning log message about static type registry usage and how to remedy it HOT 1
- Improve warning log message about static type registry usage and how to remedy it - Merge [#16656]
- Dialect is set as null in AbstractField.cast HOT 1
- containsIgnoreCase() behaviour change (maybe regression) HOT 10
- Getting "constructor cannot be applied to given types" error in generated records with an associative array HOT 2
- Wrong source code generated when newline escape sequence of long view source is split into two HOT 3
- Wrong source code generated when newline escape sequence of long view source is split into two - Merge [#16662]
- Wrong source code generated when newline escape sequence of long view source is split into two - Merge [#16662]
- Wrong source code generated when newline escape sequence of long view source is split into two - Merge [#16662]
- Add SQLite support for GROUP_CONCAT(DISTINCT ..) HOT 1
- Generate DAO.fetchOneByXYZ for unique columns missing with SQLite HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jooq.