mercredi 18 mars 2009

Migration notes for GraniteDS 2.0 beta 1

Hi,

GraniteDS 2.0 beta 1 has just been released. It contains a lot of changes and there are a few simple but important migration tips that must be followed in your projects to use this new version.

Packaging and deployment
The most visible change is the new packaging of the distribution. There is only one zip containing all jars/swcs in the build directory and an examples folder with all example projects that can be imported in an Eclipse workspace.
Many swcs have been removed thanks to a huge refactoring in the persistence code and there are only 2 swcs left:
- granite-essentials.swc is the core library and must be linked with -include-library
- granite.swc is the framework library and can be linked with normal Flex library linking (merge into code in Flex Builder) to reduce the final swf size

The Tide specific jars have been merged with the non-Tide jars, so server deployment now requires 2 or 3 jars depending only on the server framework and persistence provider used:
- granite.jar (the core library)
- one persistence jar (granite-hibernate.jar, granite-toplink.jar, granite-eclipselink.jar, granite-openjpa.jar, granite-datanucleus.jar)
- one server framework.jar (none, granite-spring.jar, granite-seam.jar, granite-guice.jar)

The next thing is to regenerate all your entities with the latest gas3 templates, with either the 2.0.0b1 builder or the 2.0.0b1 ant task. To check if your entities are up-to-date, just check that __laziness has been replaced by __detachedState and __initialized.

Other migration tips depend on the parts of GDS that you use:

Spring:
- The Spring service factory is now in the package org.granite.spring instead of org.granite.messaging.service. The change has to be done in services-config.xml.

Tide:
- Enable the following annotations:
Version,Name,In,Out,Observer,Destroy
Optionnally you can enable the Event annotation to try the new Tide event model.

- events dispatched upon user login/logout are org.granite.tide.login and org.granite.tide.logout instead of login/logout to avoid name conflict and handlers now get TideContextEvent instead of TideLoginEvent. TideLoginEvent has been removed.

- identity.forceLogout has been removed (identity.logout has been fixed with Flex JIRA BLZ-310 workaround)

Tide/Seam:
- JPA entities that will be managed by Tide must now be annotated with @EntityListener(org.granite.tide.data.DataListener.class). This can be done only once in an abstract base class or alternatively in the orm.xml configuration file.

- status messages are now available in context.statusMessages.messages instead of context.messages, and statusMessages can be injected as a client component with [In] public var statusMessages:StatusMessages.


A next post will describe the new features in this release in more details.

William

3 commentaires:

Unknown a dit…

Hi,
I am trying to use tide's lazy fetching provision from flex. But i am not getting any data from my lazily fetched list of data objects. As written, the UI component does not trigger any server calls to fetch the data. The service config file has the SeamServiceFactory as the factory.
I have my entity manager defined in seam "components.xml" file.

"- persistence:managed-persistence-context name="entityManager"
auto-create="true"
persistence-unit-jndi-name="java:/MyEntityManagerFactory" - "

1:How would tide make UI component initiate the server call and use entity manager to fetch the lazily loaded data?
2:Does the data need to be a Set on Java side or it can be a List too?
3:Does the dataprovider to UI component be a ListCollectionView or it can be Arraycollection too?
4: Can't we get data without making the lazily fetched list bound to a UI Component,if yes than how else when will it be available.

William Draï a dit…

The collection can be a Set, List, Bag or Map. When retrieved in Flex, it is always wrapped in a PersistentCollection or PersistentMap (that the reason for gas3 generating ListCollectionView properties). You can find in the docs (GDS or Adobe Flex) how to fetch data from a lazy collection (just google for ItemPendingError).
I can suggest that you continue on the forums if you have further questions, you will be answered more quickly.

Viresh a dit…

Marble Countertops make an excellent surface for rolling out dough, chopping and other kitchen work.