Hibernate is great, but often one has to specify queries as HQL in Strings, or as criteria which allow building of invalid queries.
It would be great to use the java type system to help enforce correct queries. I am aware of some tools to do this, but all the ones I have seen require either [...]
By benji | September 16, 2010
One annoyance in Java is having to do instanceof checks on multiple lines. e.g.
if (object instanceof Foo) {
Foo foo = (Foo)object;
foo.foo();
}
While this is often a sign of a design failure, there are times when instanceof checks are required often due to framework constraints etc. The above is [...]
Also posted in Uncategorized | Tagged Java |
Here’s a sillier one from last night…
People often complain about not being able to return multiple values from a method in Java. I can’t see a good reason for wanting to do this, but some do.
The example I was given was wanting to do:
int foo, bar, baz; list(foo, bar, bar) = func(ponies);
Where func(ponies) returns 3 [...]
Posted in Java | Tagged Java |
We often discuss Java limitations on IRC and try to come up with (sometimes silly) workarounds. Unfortunately after time passes it’s often easy to forget the outcome, and lose code snippets. So I thought I’d start blogging some of them so I don’t lose them, and other people might suggest other ways of doing things [...]
Also posted in Uncategorized | Tagged Java |