Saturday, June 27, 2009

Multiple Data sources and Seam

If You are using multiple data sources with seam there is a big possibility that You will get to the problem of transaction propagation from one data source to another.

With EJB it is easy since You can use REQUIRES_NEW transaction type on methods on other data source but since in Seam this is not present (for the reason I am not aware of) and if going to XA data sources is not an option than there is a simple solution that will work perfectly if You need just to read the data from one data source.

Solution is to use the on the data source You need transactions on and to use for the data source from which You read data.

If You require transactions on both data sources then XA is maybe the only way to go.

Seam convertEntity and ValueNot valid solution

There are a few things that You should note when using :

  • Be sure to keep one persistence context throught out the whole form

  • Implement equals and hashcode

  • In equals method be sure not to compare against Class types since the objects are proxified and the classes doesn't comply if You compare it simple as this.getClass().equals(other.getClass())

  • In equals method be sure to always use getters if You are using JPA since the properties in proxy objects are not initialized if You access it directly. So always use: this.getId().equals(other.getId())



And thats about it. Happy converting :)

Thursday, June 4, 2009

Export release with Non-embeded resources option

In Flex Builder even if this option is checked it can happen that You don't get all the assets copied after after all!!

The solution is to copy the assets manually to the bin-release folder and do the export again and voila!

Monday, June 1, 2009

Flash Builder 4 is out!

Well still in beta release but there are a lot of features presented. Flash builder 4 brings a lot of features already present in the Java world for Eclipse, so there are outline, library grouping, generate getters and setters, some way of code formatting (yes with indentation correction!), generators for the event handlers (the most tiring thing before) and great designer improvements provided with the usage of Flash Catalyst (http://labs.adobe.com/technologies/flashcatalyst/).

So be sure to check it out and follow on the demonstration videos available on http://labs.adobe.com/technologies/flash/videos/ to get you started.

And of course download the Flash Builder 4 and simply start using it :) and enjoy the new features.

Tuesday, May 26, 2009

Caution when overriding data setter method in Flex

Recently I was presented with a TileList control which was not rearranging properly and seems like it was loosing the items while being resized.
Looking around through the itemrenderer implementation I saw that there is overriden data setter method.

override public function set data(value:Object):void {
if (value != null) {
user= value as User;
}
}



This is wrong!

This was also the cause of all the problems that were there with the TileList not being able to render properly its data. It is very important to call the super.data setter when overriding this method.
This method dispatched Flex Data change event and invalidated display list so it allows component to propertly rerender itself.

The correct override should look like this:


override public function set data(value:Object):void {
super.data = value;
if (value != null) {
user= value as User;
}
}

Wednesday, March 18, 2009

One more way for AIR not to render flash inside HTML component

If you want to put your application in FULL_SCREEN_INTERACTIVE You can expect not to have flash rendered.

One way to have flash rendered is to use current screen resolution and set the size on your application.

Monday, March 2, 2009

AIR HTML component and Flash content

HTML component in Air is really useful, but when you want to put it in a semi transparent container or want to rotate it then there is a problem flash and pdf content won't render any more.
So if you want to see the flash in html component you shouldn't:
- change alpha to html component or to its container
- change scaling to something other than 1.0
- rotate it or the container holding the component
- set to the windowed application to be chromeless and transparent.

So if you for instance have an inner window which is semitransparent and want to display html content inside it you should not put the html component inside that window but put it in the main window which is not transparent and position it over the transparent part of the application.