Category Archives: Software Engineering

Unidirectional 1:1 relationships with Hibernate annotations

This is mainly a note to self because I screw up every time I need to write something like that, so here’s an example for myself in the future.

@Entity
@Table( name = "master" )
public class Master {
	@Id
	@GeneratedValue( generator = DBConstants.MASTER_SEQ )
	@SequenceGenerator( name = DBConstants.MASTER_SEQ, sequenceName = DBConstants.MASTER_SEQ )
	private long id;
	
	@OneToOne( fetch = FetchType.LAZY, optional = false, targetEntity = Detail.class, cascade = CascadeType.ALL )
	@PrimaryKeyJoinColumn
	private Detail detail;

	// ...
}

@Entity
@Table( name = "master_detail" )
public class Detail {
	@Id
	@GeneratedValue( generator = DBConstants.DETAIL_SEQ )
	@SequenceGenerator( name = DBConstants.DETAIL_SEQ, sequenceName = DBConstants.DETAIL_SEQ )
	private long id;

	// ...
}

Reference: java.sun.com, Tadtech

GWT 1.7.x + Safari 4.0.4 = Crash

I installed the Safari 4.0.4 update yesterday on my OS X 10.5.8 (Leopard) and got GWT 1.7.x crashes ever since then. That’s a pitty since I’m involved in a larger GWT project (featuring GWT Canvas). There’s already a ticket and a simple workaround available but that’s no choice for production environments. So if you have a Google account, please vote for it so it gets resolved soon. Apparently it’s a Webkit bug which will be fixed in Safari 4.0.5.

Update: I could downgrade back to Safari 4.0.3 using Pacifist and the Safari 4.0.3 installation package. I opened the package with Pacifist and chose “Replace” as the option for all files. Trying to apply the package alone won’t help because it detects that a later version was installed, even if you try to remove Safari competely using AppZapper.

Safari’s “About” screen shows version 4.0.3 again, OS X asks me to update to 4.0.4 again and my GWT application is back running. Not sure whether there are any other side effects, though, so handle with care.

Another update: Someone wasn’t as lucky as me and screwed his system with that approach. Better follow this instruction.

Android Developer Challenge

Google has announced the second Android Developer Challenge and I’m seriously considering taking part. They have ten different categories with three attractive prizes each and one overall category with three even more attractive prizes. Given the facts that there were only 1788 submissions last year, that I have already gathered some experience in mobile device development and that I do work with several Google APIs for my freelancing job I consider my chances not too bad. Idea, anyone? 😉

Crunch-time

I didn’t talk to my girlfriend very much lately. I didn’t read many blogs. I didn’t watch any movies. I didn’t breathe much fresh air. I didn’t use my PC for anything more than listening to music or fetching mails. I didn’t sleep much more than four hours the last two weeks or so. I neither wrote a single line of code for DVW nor attended the last sechsta sinn team meeting. I have a new game on my desk right next to me but I didn’t even bother to install it yet. I get asked whether I’m sick because I look like a zombie when I creep around the office in the morning at noon. I currently drink so many energy drinks that my heart beats heavily when I finally try to get some sleep (so eventually I don’t get any). I’m sitting here with the MacBook Pro on my lap, big headphones with music on my head and two separate headphones in my ears, one connected to the MacBook and one to an iPod. I wrote about 15000 lines of code in the last eight weeks in my spare time, and there’s a deadline coming so close so quickly that I fear I will hit me like a bullet train.

It’s crunch-time, baby.