Messing with Hibernate IDs

Posted Thu, 17 May 2007 11:46:03 GMT

What happens if you have a class with auto-generated ID, but you also want to have some of the ID values hard-coded? A mess.

Say I have a class Currency, with an ID , which is auto-generated, but I want (the reason is irrelevant at the moment and not subject of discussion) USD and JPY to have IS 1 and 2, respectively. So, I have:

Currency jpy = new Currency(2, "JPY");
hibernateTemplate.saveOrUpdate(jpy);

Well, that’s going to cause you some trouble. If USD is already in the DB with the ID of 2, this will work. If, however it is not, it will throw an Exception, saying that:

Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

Quite annoying, but understandable - it ignores my ID, assigns it another ID, and then tries to issue an update for that new ID, which of course returns nothing, or even worse, updates some other record, which happens to have the same id.

Personally, I wouldn’t mix them.

no comments | no trackbacks

Multitasking as procrastination

Posted Thu, 12 Apr 2007 19:08:00 GMT

The problem with having many tasks on hand is that you always have something easier to do. So when you hit a bit of a rough patch, you just switch to an easier one. Which is why I’m now writing this rant instead of organising my summer holiday in Central America.

Don’t know if it happens to other people, but it certainly happens to me. And then all the tasks become stuck right at the rough spot, so you have trouble deciding which one of the many stuck ones to target and spend more time switching than actually achieving something. OK that’s enough, let’s find something easier to do now……

PS. Which, I guess, explains why people complain that they spend X hours a day reading/replying to/writing emails. Hm… this doesn’t seem to be going anywhere, ooh, look! here comes an email, let’s follow it up…..

PS2. …and why pair programming is more efficient than solo-programming - you just can’t switch every time you hit a wall….

no comments | no trackbacks

Microsoft's .net talk at the SPA

Posted Wed, 28 Mar 2007 21:33:00 GMT

I found it astonishing that some people in the software development community still use the What-was-he-smoking? joke. But what I found even more astonishing is that some people (thank god not many) still laugh at it!

Anyway, Microsoft seem to have grown up a bit (it takes some battering, love, hate, near death experiences, and other emotions that don’t normally come from programming) so there was none of that at their talks. Oddly enough their talk this morning was actually funny (delivered by Eric Nelson, apparently a Geordie).

It almost made the Apple vs PC adverts abundant in London’s tube seem completely irrelevant. May be it is only geeks who pay attention to them.

Microsoft seem capable to develop some really cool and adventurous stuff nowadays. The UI they showed us, made with Windows Presentation Foundation is very impressive, easy to make and easy to use. It’s just good. It also completely separates development from design. Like, I write this thing here in terms of buttons and tables and test it that way, but then some designer somewhere else can make my button look like a picture and my table look like a Christmas tree. Like web for the desktop…. pretty cool.

If that’s not good enough, look at the seemingly simple, but actually quite insightful things like Powershell. Hint: everything’s a .net object. Hint2: look at that URL. Or IronPython. Or all the little things that show Microsoft as one of the most open-minded ego-less companies that exists at the moment.

Contrast this with some companies’ teen-minded Mum-said-I’m-better-than-you or Sun’s where-did-I-leave-my-glasses attitudes….

no comments | no trackbacks

Complete transparency

Posted Wed, 28 Mar 2007 19:37:00 GMT

This blog hasn’t seen so many entries for a long time (may be that’s why it broke in the middle of the big entry I was writing half hour ago) but there you go… these conferences can be inspirational. On so many levels…..

Anyway, anyway… the thing I’m writing about now is the talk given by Dave Thomas on… I don’t remember what, but there was a lot of heroic epic tales there. Amongst them, the trained ear (from years of exposure to Rational, IBM, etc consultants) could pick out a lot of extremely wise ideas.

Some (in my opinion) extremely wise keyphrases were: “House of quality”, “Everything is a story”, “The code speaks to me as an executive”, “Why do I need management reports when I can see everything in real time as it unfolds?”

Not elaborating here as everyone can look them up. The wisest, and may be the composite idea was that of complete transparency.

Big Dave painted a picture where the executives could find out everything about a project by just looking at things produced from the source code and the issue tracking system as sole inputs.

Oh, yeah, diversion, I brought my notes here on the way back from the kitchen, the talk was on “Large Agile Projects”. Cool… Exciting! Arctic exploration and trained killers were in the vocabulary… oh the excitement!…..

So, how does it all become so disarmingly transparent, we asked, and we were given this link. It’s good. It does actually explain how you can make the code speak as an executive by making EVERYTHING a deliverable artifact and EVERYTHING a story.

Like, the management or the customer requires a regular report on progress. That is a requirement of the project. So the obvious thing is to make it a story. It takes some effort (has cost) and it produces measurable results. It is subject to prioritisation. It needs to be trackable and auditable. The time spent on it comes from the overall project time. So why not make it a story. That makes everything trackable, auditable, and ultimately transparent.

Rise to the meta-level, that’s what I call this.

no comments | no trackbacks

The Goldfish Bowl meeting format

Posted Wed, 28 Mar 2007 19:02:12 GMT

I really liked the Goldfish Bowl discussion format at the SPA 2007. Basically, what that is, is that a small number of chairs (three to five, depending on the size of the group) are placed in the centre of the room and only those sitting in them are allowed to speak. One of the chairs must always be empty, so if someone sits in it, someone else must leave. Obviously everyone can listen.

It makes you only sit in the chair if you really have something to say and are prepared to put some more effort in discussing it. It requires physical action if you want to speak, so nobody is tempted to just throw in ill-conceived remarks mid-conversation. It also allows for almost seamless removal of people who fall into endless rants by a thinking majority - it’s almost spooky but it kind of worked in the two sessions I atended.

Oddly enough, there was hardly any contention - as soon as someone took the empty chair, someone left. The pressure of being watched by twenty people sitting there for a long time really makes you think if you are actually contributing something to the discussion or just moaning or saying nothing.

I wonder if that can be brought into meetings in general business setting. I guess the minimum participation should be about eight people in which case three chairs in the middle should be enough.

There are also a lot of knobs for regulating the heat of discussion - there’s nothing to stop you from adding another chair, or removing one, or not providing seating place for the listeners, so that they are more inclined to sit in and talk.

no comments | no trackbacks

Older posts: 1 2 3 4 5 ... 14

Home

Who's George?

Recent entries