Monday, February 15, 2010

Seam 2.2 + Jboss 5.1: a resolution

A few weeks ago I posted about my difficulties migrating to new versions of jboss and seam.

I was finally able to resolve these difficulties by following these steps:

  • I first took the suggestion of this post on and used seam-gen to generate a basic seam application that worked with my existing database.

  • I then replaced all the libraries with the ones from the newly generated application.

  • As a penultimate step I followed the procedure outlined in the migration guide.

I was now able to search for differences between the new and the old version.
The primary differences were in the * classes

--the new version of the code followed the pattern:

private static final String[] RESTRICTIONS = {“lower( like concat(lower(#{}),’%’)”,};
private static final String EJBQL = “select shows from Shows shows”;
public ShowsList() {

--- the pattern in the old version was:

private static final String[] RESTRICTIONS = {“lower( like concat(lower(#{}),’%’)”,};
private Shows shows = new Shows();
public String getEjbql() {
return “select shows from Shows shows”;
public Integer getMaxResults() {
return 25;

The primary difference is that the restrictions used the setRestrictionExpressionStrings method. As one of the commenters on the seamframeworks post mentioned: it would have been good to have discussed this in the migration document.

Not a tremendously big deal but, as I said previously, disappointing.

Monday, February 1, 2010

popViewControllerAnimated & message sent to deallocated instance

This is just an informational posting -- it is so odd I thought I'd share.

If you have any of the following:

  • controllerDidChangeContent

  • didChangeSection

  • didChangeObject

  • controllerWillChangeContent

in the same class as a save that does a
when the save completes you will get a

controllerWillChangeContent:]: message sent to deallocated instance (insert your address here)

I'm not exactly sure how this happens
but essentially
these methods hold onto the old copy of self in some manner.

Here's an example:

(gdb) p self
$1 = (GroupItemSelectViewController *) 0x3a34f70
Current language: auto; currently objective-c
(gdb) c

Now pop back to the old screen and then do some editing:

2010-01-05 20:34:36.052 GoodToGo[62202:207] (GroupItemSelectViewController:didSelectRowAtIndexPath) setting Item to YES
2010-01-05 20:34:37.960 GoodToGo[62202:207] (GroupController:numberOfRowsInSection) rows: 3
2010-01-05 20:34:39.902 GoodToGo[62202:207] (GroupController:numberOfRowsInSection) rows: 2
2010-01-05 20:34:42.690 GoodToGo[62202:207] (GroupController:numberOfRowsInSection) rows: 3
2010-01-05 20:34:43.561 GoodToGo[62202:207] (didSelectRowAtIndexPath) Selecting row 0
2010-01-05 20:34:43.563 GoodToGo[62202:207] (GroupItemSelectViewController:viewDidLoad) fetchedItemCount:5, holderCount: 5

What is the current value of self?

(gdb) p self
$2 = (GroupItemSelectViewController *) 0x3c84820
(gdb) c
2010-01-05 20:34:51.690 GoodToGo[62202:207] (GroupItemSelectViewController:didSelectRowAtIndexPath): setting Item to NO
2010-01-05 20:34:53.546 GoodToGo[62202:207] (GroupController:numberOfRowsInSection) rows: 3
2010-01-05 20:34:53.547 GoodToGo[62202:207] *** -[GroupItemSelectViewController controllerWillChangeContent:]: message sent to deallocated instance 0x3a34f70

As you can see 0x3a34f70 is the previous value of self, not its current value.

I do consider this a bug in the framework.