[flexcoders] Dot notation to access objects inside a datagrid column

2006-12-07 Thread Niko Schmuck
Hi FlexCoders:

Coming from a Java background, I was surprised that the dot operator is
not working as I expected.

The array with the data structure and children is populated from the 
(Hibernate) data source at creationComplete time with:

  ds.fill(users, all.users, []);

The array collection is declared via:

  mx:ArrayCollection id=users /

and then used inside the datagrid ...

  mx:DataGrid id=dgrid dataProvider={users} editable=false
mx:columns
mx:DataGridColumn headerText=User ID dataField=id/
mx:DataGridColumn headerText=First Name dataField=firstName/
mx:DataGridColumn headerText=Last Name dataField=lastName/
mx:DataGridColumn headerText=Group dataField=userGroup.name/
/mx:columns
  /mx:DataGrid

Unfortunately the dot-access to the related user group name seems not to
work, there is just nothing being displayed. If dataField=userGroup then
there is [object UserGroup] displayed inside the datagrid column.

So how do you retrieve the properties of the related user group object?

Thanks for your help,
Niko


PS: The classes for value objects look very straight-forward:

// User.as
package com.example.flex
{

[Managed]
[RemoteClass(alias=com.example.flex.User)]

public class User
{

public var id:Number;
public var firstName:String = ;
public var lastName:String = ;
public var userGroup:UserGroup;

public function User() {
}

}
}


// UserGroup.as
package com.example.flex
{

[Managed]
[RemoteClass(alias=com.example.flex.UserGroup)]

public class UserGroup
{

public var id:Number;
public var name:String = ;

public function UserGroup() {
}

}
}






[flexcoders] FDS: Using Hibernate second-level cache possible?

2006-12-06 Thread Niko Schmuck
Hi together,

As a newbie I would like to get your advices on how to use the Hibernate
caching for Flex Data Management Services. Is this possible at all or a
contra-diction to the HibernateAssembler?

For my java applications I currently use second-level caching to speed up
data access with Hibernate (3.2), which I would also like to use for my
Flex app:

For this I use in the Hibernate mapping definition (inside the class
element):

  cache usage=read-write/

Unfortunately if I turn EhCache on (via the hibernate configuration) ...

  property
name=cache.provider_classorg.hibernate.cache.EhCacheProvider/property

... the tomcat logs show an ugly stack-trace:

  CacheException: Attempt to restart an already started EhCacheProvider.

See below for the exception in its full-length beauty. The only way to
overcome this, to avoid caching at all by setting:

  property
name=cache.provider_classorg.hibernate.cache.NoCacheProvider/property

(Also using the recommended SingletonEhCacheProvider does not help)

Any help much appreciated.

Thanks,
Niko





2006-12-05 08:57:08,737 [main] ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/useradmin]
 - Servlet /useradmin threw load() exception
java.lang.ExceptionInInitializerError
at
flex.data.assemblers.HibernateManager.createSessionFactory(HibernateManager.java:66)
at
flex.data.assemblers.HibernateManager.init(HibernateManager.java:44)
at
flex.data.assemblers.HibernateAssembler.initialize(HibernateAssembler.java:137)
at
flex.messaging.factories.JavaFactory$JavaFactoryInstance.createInstance(JavaFactory.java:254)
at
flex.messaging.factories.JavaFactory.createFactoryInstance(JavaFactory.java:93)
at
flex.messaging.FactoryDestination.getFactoryInstance(FactoryDestination.java:76)
at flex.data.adapters.JavaAdapter.server(JavaAdapter.java:158) at
flex.data.adapters.JavaAdapter.setSettings(JavaAdapter.java:119)
at flex.messaging.Destination.createAdapter(Destination.java:279)
at
flex.messaging.Destination.initDestination(Destination.java:103)
at
flex.messaging.FactoryDestination.initDestination(FactoryDestination.java:58)
at flex.data.DataService.createDestination(DataService.java:90) at
flex.messaging.services.AbstractService.createDestinations(AbstractService.java:82)
at
flex.messaging.config.MessagingConfiguration.createServices(MessagingConfiguration.java:187)
at
flex.messaging.config.MessagingConfiguration.configureBroker(MessagingConfiguration.java:84)
at
flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:105)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4225)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at
org.apache.catalina.core.StandardService.start(StandardService.java:450)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: org.hibernate.cache.CacheException: Attempt to restart an
already started EhCacheProvider. Use sessionFactory.close()  between
repeated calls to buildSessionFactory. Consider using
net.sf.ehcache.hibernate.SingletonEhCacheProvider.
at