Hey Carlos, I'll be implementing my object IDs in this manner, it's a good article:
http://www.onjava.com/pub/a/onjava/2006/09/13/dont-let-hibernate- steal-your-identity.html?page=1 Thanks John K. --- In flexcoders@yahoogroups.com, "Carlos Rovira" <[EMAIL PROTECTED]> wrote: > > Hi Ripe, > > I'm facing another problem with IDs and Hiberntate. > > By default Hibernate expects a id = null in order to think that is a new > entity, but FDS changes the ID to 0 when converts the object from client > side (flash) to java. > > could you tell me if you get your ids set to 0? > > I'm trying to configure Hibernate so the default value will be 0 but I'm not > be able to do it until now :( > > > > On 1/17/07, ripe101 <[EMAIL PROTECTED]> wrote: > > > > I found the issue that caused my problem. Replying to my own post > > for anyone dealing with this in the future. > > > > My setter method for the "id" property was defined as private. This > > is recommended in Hibernate docs for id type fields: > > > > see > > http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html#t > > utorial-firstapp > > > > "However, we usually don't manipulate the identity of an object, > > hence the setter method should be private." > > > > Apparently even though I was using only the getter method in my mxml, > > Flex didn't like the setter method being inaccessable. So the > > property was never returned. > > > > Took a few days to track this down, so hopefully this will help > > someone else out. > > > > cheers > > JK > > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, > > "ripe101" <ripe909@> wrote: > > > > > > Hello, > > > > > > I'm trying to integrate FDS and Hibernate, I've gotten it mostly > > > working, but I have one remaining issue... > > > > > > I Have FDS running on JBoss 4.0.5GA, with hibernate 3. > > > > > > I've got all the bits working except the (hibernate) "id" field is > > > not coming across to Flex. All of the other fields come across > > > except this one (!) > > > > > > I can see Hibernate sending the attributes, but in the Flex message > > > they don't appear. > > > Anyone seen this happen? > > > > > > * logs: > > > * from Hibernate: > > > 2007-01-15 08:37:48,281 DEBUG [org.hibernate.pretty.Printer] > > listing > > > entities: > > > 2007-01-15 08:37:48,343 DEBUG [org.hibernate.pretty.Printer] > > > users.Users{EMAIL_ADDRESS=admin2@, USER_NAME=ADMIN2, > > > id=23} > > > 2007-01-15 08:37:48,343 DEBUG [org.hibernate.pretty.Printer] > > > users.Users{EMAIL_ADDRESS=admin@, USER_NAME=ADMIN, id=22} > > > 2007-01-15 08:37:48,343 DEBUG [org.hibernate.pretty.Printer] > > > users.Users{EMAIL_ADDRESS=user@, USER_NAME=USER, id=21} > > > > > > * from FDS > > > 09:38:06,140 INFO [STDOUT] Hibernate: select users0_.USER_KEY as > > > USER1_0_, user > > > s0_.USER_NAME as USER2_0_, users0_.EMAIL_ADDRESS as EMAIL3_0_ from > > > ID_USER users > > > 0_ > > > 09:38:06,203 INFO [STDOUT] [Flex] Serializing AMF/RTMP response > > > Version: 3 > > > (Command method=_result (0) trxId=3) > > > (Typed Object #0 'flex.data.messages.SequencedMessage') > > > sequenceId = 0 > > > destination = "users" > > > headers = (Object #1) > > > dataMessage = null > > > correlationId = "35BE4552-FD9F-6E63-0542-2668798A1325" > > > messageId = "6DC516AF-CB2D-F630-393D-1BECA9C93882" > > > timestamp = 1.168875486203E12 > > > clientId = "8A9CAB6A-41D5-E6B8-8274-266877D45B54" > > > timeToLive = 0.0 > > > sequenceProxies = null > > > sequenceSize = 3 > > > body = (Array #2) > > > [0] = (Typed Object #3 'users.Users') > > > EMAIL_ADDRESS = "admin2@" > > > USER_NAME = "ADMIN2" > > > [1] = (Ref #3) > > > [2] = (Ref #3) > > > > > > > > > * Here is my hibernate mapping (stripped off the DOCTYPE): > > > > > > <hibernate-mapping> > > > <class name="users.Users" table="ID_USER"> > > > <id name="id" column="USER_KEY"> > > > <generator class="identity"/> > > > </id> > > > <property name="USER_NAME"/> > > > <property name="EMAIL_ADDRESS"/> > > > </class> > > > > > > <query name="all.users">from Users</query> > > > </hibernate-mapping> > > > > > > * and the corresponding FDS data-management-config.xml: > > > > > > <?xml version="1.0" encoding="UTF-8"?> > > > <service id="data-service" > > > class="flex.data.DataService" > > > messageTypes="flex.data.messages.DataMessage"> > > > <adapters> > > > <adapter-definition id="actionscript" > > > class="flex.data.adapters.ASObjectAdapter" default="true"/> > > > <adapter-definition id="java-dao" > > > class="flex.data.adapters.JavaAdapter"/> > > > </adapters> > > > <default-channels> > > > <channel ref="my-rtmp"/> > > > </default-channels> > > > <destination id="users"> > > > <adapter ref="java-dao" /> > > > <properties> > > > <use-transactions>true</use-transactions> > > > <source>flex.data.assemblers.HibernateAssembler</source> > > > <scope>application</scope> > > > <metadata> > > > <identity property="id"/> > > > </metadata> > > > <network> > > > <paging enabled="false" pageSize="10" /> > > > <throttle-inbound policy="ERROR" max- > > frequency="500"/> > > > <throttle-outbound policy="REPLACE" max- > > > frequency="500"/> > > > </network> > > > <server> > > > <hibernate-entity>users.Users</hibernate-entity> > > > <fill-method> > > > <name>fill</name> > > > <params>java.util.List</params> > > > </fill-method> > > > <fill-configuration> > > > <use-query-cache>false</use-query-cache> > > > <allow-hql-queries>true</allow-hql-queries> > > > </fill-configuration> > > > </server> > > > </properties> > > > </destination> > > > </service> > > > > > > Thanks! > > > JK > > > > > > > > > > > > > -- > ::| Carlos Rovira > ::| http://www.carlosrovira.com > ::| http://www.madeinflex.com >