Saturday, June 18, 2005

JAVA/J2EE: Primary Keys & XFR Technology

That stands for “eXtremely Fucking Retarded”

I’ve been reading on this one topic all day, which is becoming the norm for my J2EE/EJB research. Here’s the final verdict:

EJB 1.x and 2.x do not support auto-incrementing ID (primary key) fields in a database. Stop for a second and consider how retarded that really is. After serious digging, here are the responses to plaguing question of ‘what the fuck do I do?’:

1. Go for a vendor-specific extension of EJB that lets you do it. WebLogic, WebSphere and JBoss have em. Sun App server does not appear to. Just my luck, I’m using Sun App server
2. Go O.G. style and make an entity table with a “sequence” and “entity” column (i.e. tablename and ID count)
3. Make a special bean that manages IDs, thus emulating #2
4. Insert pseudo-random #’s for your ID’s (like system time…. Ew)
5. Scratch your head attempting to figure out where all the time savings are

EJB 3 finally has auto-increment support, but isn’t ready for prime time (app servers aren’t to that spec yet) It took Sun 6 years to include this very basic concept in their specification. Very disappointing. All this agitation is going to make for some serious elation once I manage to get anything to work.

0 Comments:

Post a Comment

<< Home