armtuk: Cheetah (Default)
If you can even figure out how this works, Kudos. I'm pretty proud I figured out how to make this. There might be better ways, but this way works, and gets me what I need:

select * from task x, (select p.project_id, u.workflow_id, (select min(due_date) as min_due_date from task t where t.workflow_id=u.workflow_id) as min_due_date from task u, workflow p where u.workflow_id=p.workflow_id group by u.workflow_id, p.project_id) y where x.due_date=y.min_due_date and x.workflow_id=y.workflow_id;

Muhahahaha.
armtuk: Cheetah (Default)
Why can't I do this?

update sp_college_game n set n.game_status_ev_id=6 where n.college_game_id in (select a.college_game_id from sp_college_game a, sp_college_playoff_entry b where a.college_game_id = b.game_id)

It's not that hard! Oracle will let me do that, and so will PostgreSQL, but MySQL is too crap.

Did I mention that you have to a stupid idiot to walk outside to talk on your cell phone with nothing more than a long sleeve T-Shirt on! It's frikin cold!
armtuk: Cheetah (Default)
super computer science geekness here )
armtuk: Cheetah (Default)
So for today's hard knocks hibernate lesson we learn that putting annotations on Member variables instead of Member Functions is a really bad idea. It breaks when you use inheritance. If you inherit from a MappedSuperclass and that superclass has members that are complex objects, then when you inherit them, all the annotations are ignored in the subclass, so you end up with database fields being of type bytea (at least in PostgreSQL) instead of being correctly mapped as foreign keys.

So in summary: Don't put annotations on member variables, always put them on member functions.

*SIGH* time to refactor 32 database classes.

At least I found the problem quickly.
armtuk: Cheetah (Default)
I am struggling through Hibernate funness. I bought the O'Reilly book, but it's a bit thin, and after reading a few peoples' reviews, I also got the Persistence with Hibernate book from Manning which is AWESOME.

the merge method is evil. It looks like a good replacement for persist() but it isn't. merge() doesn't actually tie the object to the database state, so if you call merge() repeatedly on an object with no Id, it will save it repeatedly. persist() however does the right thing. The only thing merge gives you is the ability to save an object across sessions, but it would probably be better to attempt to re-attach the object instead of merging it.

Wicket

Oct. 14th, 2008 04:25 pm
armtuk: Cheetah (Default)
I have just started looking through the book on Wicket. They seem to have the same feeling towards MVC that I do: it's a fundamentally broken approach to web sites. I'm glad I'm not insane :). I got a chance to read some of it whilst Thomas got his hair cut. I am hopeful that the rest is as good as the start.

Profile

armtuk: Cheetah (Default)
armtuk

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819 202122
23242526272829
30      

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 23rd, 2017 09:19 am
Powered by Dreamwidth Studios