Yes, this did work. Thanks a lot Jeff.

--- In [email protected], "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> You'll need to make sure you have "dept" defined as an association
> property in the "Emp" destination.
> 
>  
> 
> When you have association properties between two data types, those types
> will use the same commit queue so you can remove the first
> dataServiceDEPT.commit().  The second commit on the dataServiceEMP
> instance will commit both the new department and the new employee.
> (The queue is stored on the DataService's dataStore - so
> dataService.commit() really is just a call to
> dataService.dataStore.commit().  dataServiceDEPT.dataStore should equal
> dataServiceEMP.dataStore.  By sharing one queue, we can keep
> dependencies like the one between the dept and the emp in the right
> order. 
> 
>  
> 
> If you send two new items to the server in the same batch, FDMS will
> create the first item get its id, update that id in the reference for
> the second item, then create the second item.  
> 
>  
> 
> If you send the create for the first item in one batch, you need to wait
> for the commit result to come back before you can issue the create for
> the second item.  This is a bug in FDMS that we need to fix... 
> 
>  
> 
> Jeff
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of sunilpatel_10
> Sent: Tuesday, January 23, 2007 7:18 AM
> To: [email protected]
> Subject: [flexcoders] Re: FDS createItem - how to find ID of inserted
> record?
> 
>  
> 
> Thans Olivier for the reply. However, I am using Hibernate, FDS and
> Flex 2.0 with MySQL - Much like the CRM sample application with
> Hibernate. I didn't write my own DAO. The canvas has dept code, dept
> name, emp first name, emp last name. On click of save, I want to save
> dept info in DEPT table (ID, CODE, NAME) and EMP info in EMP table
> (ID, DEPT_ID, FNAME, LNAME) with EMP.DEPT_ID as new DEPT.ID - the code
> looks something like this - 
> 
> dept = new Dept();
> dept.code = fcode.text;
> dept.name = fname.text;
> var ir:ItemReference = dataServiceDEPT.createItem(dept);
> dataServiceDEPT.commit();
> 
> emp =new Emp();
> emp.dept = dept;
> emp.fname = ffname.text;
> emp.lname = flname.text;
> dataServiceEMP.createItem(emp);
> dataServiceEMP.commit();
> 
> This code creates a new DEPT but not an EMP record. Help !!!
> 
> Thanks
> 
> --- In [email protected] <mailto:flexcoders%40yahoogroups.com>
> , "Stembert Olivier (BIL)"
> <olivier.stembert@> wrote:
> >
> > Hi,
> > 
> > You should set the id in your dao class.
> > Here is an example with a dao using Spring:
> > 
> > public void create(Dept dept) throws DataAccessException
> > {
> > String sql = ...
> > NamedParameterJdbcTemplate template = new
> > NamedParameterJdbcTemplate(this.getDataSource());
> > MapSqlParameterSource namedParameters = new MapSqlParameterSource();
> > ...
> > template.update(sql, namedParameters);
> > int id = getJdbcTemplate().queryForInt("call identity()");
> > dept.setDeptId(id);
> > 
> > }
> > 
> > Regards,
> > 
> > Olivier
> > 
> > 
> > ________________________________
> > 
> > From: [email protected] <mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of sunilpatel_10
> > Sent: Saturday, January 20, 2007 2:25 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] FDS createItem - how to find ID of inserted
> > record?
> > 
> > 
> > 
> > Hi,
> > 
> > I have a page where I capture DEPT and EMP data. On click of a button
> > I want to save DEPT record and all the EMP records with ID of newly
> > created DEPT as a parent. I use FDS, hibernate and db generated IDs.
> > The problem I am facing is how do I get the ID of DEPT record created
> > by createitem() and access it to assign this DEPT as a parent of EMP
> > records that I want to create? If I examine ID of dept object used in
> > createitem after FDS commit(), it is still 0. Appreciate your help.
> > 
> > 
> > 
> > 
> > 
> > ---------------------
> > 
> > An electronic message is not binding on its sender.
> > 
> > Any message referring to a binding engagement must be confirmed in
> > writing and duly signed.
> > 
> > ---------------------
> > 
> > 
> > 
> > 
> > ---------------------
> > An electronic message is not binding on its sender.
> > Any message referring to a binding engagement must be confirmed in
> writing and duly signed.
> > ---------------------
> >
>


Reply via email to