2 Replies Latest reply on Apr 25, 2008 4:06 AM by (Thierry_Vionnet)

    livecycle is connected but no return to flex

      Hello,<br /><br />I have following the tutorial on this link : http://blogs.adobe.com/mtg/2006/08/my_first_hibernate_enabled_fle.html and the first time all was ok. <br /><br />After that, I would like to do the same thing with my own project, and I don't have any response from lcds after a call from flex...<br /><br />I explain : <br /><br />I have a MySql database with 1 table, 4 fields : userid, username, userpass, userrights.<br /><br />After that, I have created a package (directories) and java class into c:\dev\flash\lcds\jrun4\servers\default\flex\WEB-INF\src\com\myapp\app\vo\<br /><br />My class : UserVO.java<br /><br />package com.myapp.app.vo;<br /><br />public class UserVO<br />{<br />     private int id;<br />     <br />     private String username;<br />     <br />     private String userpass;<br />     <br />     private int userrights;<br />     <br />     public void setId(int id) {     this.id = id; }<br />     public int getId() { return this.id; }<br />     <br />     public void setUsername( String username ) { this.username = username; }<br />     public String getUsername() { return this.username; }<br />     <br />     public void setUserpass( String userpass ) { this.userpass = userpass; }<br />     public String getUserpass()     { return this.userpass; }<br />     <br />     public void setUserrights( int userrights ) { this.userrights = userrights; }<br />     public int getUserrights() { return this.userrights; }<br />}<br /><br />Now I compile my class with the jdk 1.4.2 to have a correct compiled file and I put my UserVO.class file into c:\dev\flash\lcds\jrun4\servers\default\flex\WEB-INF\classes\com\myapp\app\vo\<br /><br />After that, in the same folder, I create the UserVO.hbm.xml file like this : <br /><br /><?xml version="1.0"?><br /><!DOCTYPE hibernate-mapping PUBLIC<br />"-//Hibernate/Hibernate Mapping DTD 3.0//EN"<br />"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><br /><hibernate-mapping><br />     <class name="com.myapp.app.vo.UserVO" table="user"><br />          <id name="id" column="userid"><br />               <generator class="native"/><br />          </id><br />          <property name="username"/><br />          <property name="userpass"/><br />          <property name="userrights"/><br />     </class><br />     <!-- This is a named query that we will use later -->   <br />     <query name="all.users">From UserVO</query><br /></hibernate-mapping> <br /><br />Now I create the hibernate.cfg.xml file into the "classes" directory : <br /><br /><?xml version='1.0' encoding='utf-8'?><br /><!DOCTYPE hibernate-configuration PUBLIC<br />"-//Hibernate/Hibernate Configuration DTD 3.0//EN"<br />"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><br /><hibernate-configuration><br />     <session-factory><br />          <br />          <!-- Database connection settings --><br />          <property name="connection.driver_class">com.mysql.jdbc.Driver</property><br />          <property name="connection.url">jdbc:mysql://localhost/cineact</property><br />          <property name="connection.username">root</property><br />          <property name="connection.password">gandalf</property><br />          <br />          <!-- JDBC connection pool (use the built-in) --><br />          <property name="connection.pool_size">1</property><br />          <br />          <!-- SQL dialect --><br />          <property name="dialect">org.hibernate.dialect.MySQLDialect</property><br />          <br />          <!-- Enable Hibernate's automatic session context management --><br />          <property name="current_session_context_class">thread</property><br />          <br />          <!-- Disable the second-level cache  --><br />          <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>         <!-- Echo all executed SQL to stdout --><br />          <property name="show_sql">true</property><br /><br />          <!-- Load the database table mapping file --><br />          <mapping resource="com/myapp/app/vo/UserVO.hbm.xml"/><br />     </session-factory><br /></hibernate-configuration>
        • 1. Re: livecycle is connected but no return to flex
          Level 1
          Finally, i have edited the c:\dev\flash\lcds\jrun4\servers\default\flex\WEB-INF\flex\data-management-config.xml<br /><br />to add my new hibernate beans : <br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><service id="data-service" <br />    class="flex.data.DataService"<br />    messageTypes="flex.data.messages.DataMessage"><br /><br />     <adapters><br />          <adapter-definition id="actionscript" class="flex.data.adapters.ASObjectAdapter" default="true"/><br />          <adapter-definition id="java-dao" class="flex.data.adapters.JavaAdapter"/><br />     </adapters><br />     <br />     <default-channels><br />          <channel ref="my-rtmp"/><br />     </default-channels><br /><br />     <destination id="uservo.hibernate"><br />          <adapter ref="java-dao" /><br />          <properties><br />               <use-transactions>true</use-transactions><br />               <source>flex.data.assemblers.HibernateAssembler</source><br />               <scope>application</scope><br />               <metadata><br />                    <!--This is the unique identifier from the hibernate-entity bean --><br />                    <identity property="id"/><br />               </metadata><br />               <network><br />                    <session-timeout>20</session-timeout><br />                    <paging enabled="false" pageSize="10" /><br />                    <throttle-inbound policy="ERROR" max-frequency="500"/><br />                    <throttle-outbound policy="REPLACE" max-frequency="500"/><br />               </network><br />               <server><br />                    <hibernate-entity>com.neolinkup.app.vo.UserVO</hibernate-entity><br />                    <fill-method><br />                         <name>fill</name><br />                         <params>java.util.List</params><br />                    </fill-method><br />                    <fill-configuration><br />                         <use-query-cache>false</use-query-cache><br />                         <allow-hql-queries>true</allow-hql-queries><br />                    </fill-configuration><br />               </server><br />          </properties><br />     </destination><br /><br /></service><br /><br />When I start the lcds server, all is ok, no error message displayed. <br /><br />So now I go to my flex application and create my Value Object : <br /><br />into com.myapp.app.vo I create a UserVO.as file like this : <br /><br />package com.myapp.app.vo<br />{<br />     [Managed]<br />     [RemoteClass(alias="com.myapp.app.vo.UserVO")]<br />     <br />     public class UserVO<br />     {<br />          public function UserVO()<br />          {<br />          }<br />          <br />          public var id:int;<br />          public var username:String;<br />          public var userpass:String;<br />          public var userrights:int;<br />          <br />     }<br />}<br /><br />After that, I try a call to my hibernate bean : <br /><br />ds = new DataService("uservo.hibernate");<br />ds.addEventListener( DataServiceFaultEvent.FAULT, handleFault );<br />ds.addEventListener( DataConflictEvent.CONFLICT, handleConflict );<br />ds.addEventListener(ResultEvent.RESULT, handleResult );<br />ds.fill( _dataProvider,"all.users",[]);<br /><br />But I don't have any answer from the service... No return in handle functions, they don't be called at any time... If I modify the parameter of the dataService as user.hibernate, the compilator say there is an error, so the connection is established, but the call doesn't function :-(<br /><br />If anyone has an idea about this problem... I'm newbie and have searched long time to found a solution but nothing... <br /><br />Thanks in advance for any suggestion.<br /><br />Cheers<br /><br />Thierry
          • 2. Re: livecycle is connected but no return to flex
            Level 1
            I have found my mistake... the "dataProvider" arrayCollection must be initialized to accept a fill from the dataService :

            _dataProvider = new ArrayCollection();

            and all is ok