Archive for the 'Java' Category

Fixing up stale data associations in Seam’s EntityHome

Wednesday, October 29th, 2008

Through a combination of hints found online along with some guidance from the instructor at the “Seam Essentials” training course I recently attended in Austin, TX - I figured out how to solve a problem I was having where instance data on the “far side” of @OneToOne and @OneToMany data associations was not staying synchronized with values on the “near side”.

Now that I understand the solution, it becomes clear to me that all the information I needed was out there - just not all in one place with good example code.

For the sake of formatting, I’ve placed the commented code here: http://pastie.org/private/wk2v3rbw892e5vbbenum7g (and I’m NOT claiming this is good example code)

Now I can move on to the never-ending list of other challenges.

Java - JBoss - Seam - Eclipse Development Stack

Thursday, September 25th, 2008

Here’s what I have running well at the moment (likely to change over time as needs change):

  • JDK 1.6 update 7
  • mysql-connector-java (I’m using version 5.1.6)
  • JBoss Application Server 4.2.3.GA
    • To make deployment to this application server possible/easier from my non-privileged user account:
      • chown -R jerry:jerry $JBOSS_HOME
    • I am controlling this only from the command line after observing that launching it from within Eclipse causes the load on my workstation to get very high for no apparent reason.
      • cd $JBOSS_HOME/bin
      • ./run.sh
    • Since I’m also using MySQL, I have copied the mysql-connector-java-5.1.6-bin.jar file into my $JBOSS_HOME/server/default/lib
  • Seam 2.1.0.GA
    • this Seam Getting Started guide will be helpful - and there’s plenty more good info in the Reference Guide.
    • If you’re serious about Seam development, get “Seam in Action” - it’s available as a PDF file too!
    • I do all the seam-gen stuff from the command line - it’s really easy once you get into the “flow” of doing it this way (and eliminates any issues of doing it from within your IDE). This mostly amounts to only a few commands once you start working in your code:
      • seam explode (to get things started)
      • seam restart (to compile and deploy your latest code changes)
      • As the project grows and evolves, it is likely you’ll end up with customized build and deployment command-line scripts anyway.
  • Eclipse 3.4.1 (in my case, eclipse-jee-ganymede-SR1-linux-gtk-x86_64.tar.gz)
    • Nightly build of the JBoss IDE Tools. I am using JBossTools-200810010752-nightly-ALL-linux-gtk-x86_64.zip - however a more recent build should work just as well.
      • Using a recent nightly build solved my problem with the JBoss Tools Palette not working with Eclipse 3.4 as described here
    • Debugging seems to work well (as long as the server is started in “debug” mode from inside Eclipse)
    • JBoss Tools Palette works well.
    • Looks like everything is working for now.

Here’s an important chunk of my .bashrc file:

export JAVA_HOME=/usr/local/java/latest
export PATH=$JAVA_HOME/bin:$PATH

export ANT_HOME=/usr/local/apache-ant-1.7.1
export PATH=$ANT_HOME/bin:$PATH

export JBOSS_HOME=/usr/local/jboss/jboss_as/latest
export PATH=$JBOSS_HOME/bin:$PATH

export SEAM_HOME=/usr/local/jboss/seam/latest
export PATH=$SEAM_HOME:$PATH

The “latest” directory in the paths above is the result of my use of symlinks like this:

jerry@localhost
/usr/local/jboss/seam >ll
total 8
drwxr-xr-x 11 root root 4096 2008-10-23 23:03 jboss-seam-2.1.0.CR1
drwxr-xr-x 12 root root 4096 2008-10-24 15:03 jboss-seam-2.1.0.GA
lrwxrwxrwx  1 root root   20 2008-10-24 15:12 latest -> jboss-seam-2.1.0.GA/

We are sorry for the inconvenience.

Wednesday, September 3rd, 2008

Thankfully, I won’t need to see this for much longer:

visual studio crash

Whenever pair-programming with one of my co-workers, we see this one very often. I am sure their apology is sincere. My favorite part is the “No information has been lost” - when in fact we have seen plenty of instances where there WAS information lost when he couldn’t hit the CTRL-S keys quickly enough. There have been many other strange observations during my recent adventures with the .NET platform.

Soon I will be starting at a new gig where I’ll be using old familiar friends (and some new ones) like:

Of course, this means I’ll probably start writing about the new set of challenges and problems instead of these old ones :-)