Hi, 

If anyone could help me with this I'd appreciate it. FYI, I've used the
fds-tomcat.zip "testdrive" sample app to code this. I am new to everything
(MySQL, Java, Hibernate, Flex 2, LCDS, you-name-it) however many years
developing C and early web apps, so I'm now playing catch up. Please bear
with me.

Here's the facts: 

1) My custom service generates a userid and inserts the record into my User
table successfully. From my UserService.java: 

... 
Statement s = c.createStatement(); 
ResultSet rs = s.executeQuery("SELECT LAST_INSERT_ID()"); // unique userid 
rs.next(); 
user.setUserid(rs.getInt(1)); 

// System.out.println("user.setUserid " + user.getUserid() + "."); --> this
value is correctly displayed 
... 

The println displays the userid I want to use in my client properly, but the
client never seems to get it. The ItemReference in my client code does not
display the same userid, it always displays 0. Debugger shows all the
correct values for the insert populated in the ItemReference, but not the
userid. It's always set to zero. Here is my client code: 

...
import mx.data.ItemReference; 
import classes.tfdao.User; 

private function handleRegister(event:Event):void { 

var dsuserDAO:DataService = new DataService ("UserDAO"); 
var user:User = new User(); 
user.firstname = this.firstname.text; 
user.lastname = this.lastname.text; 
user.lastmoddate = new Date(); 
var userIR:ItemReference = dsuserDAO.createItem(user); 

var dsaddressDAO:DataService = new DataService("AddressDAO"); 
var address:Address = new Address(); 
// address.userid = userIR.userid ----> I know this won't work but how do I
get the correct value ???????? 
address.addressid = null; 
address.addresstypeid = 1;  //hardcoded for now
address.address1 = this.address1.text; 
address.address2 = this.address2.text; 
// yada yada ... 
var addressIR:ItemReference = dsaddressDAO.createItem(address); 

this.currentState = "registerSuccess"; 

} 


2) How do I reference the generated userid? I thought it should be in the
Item Reference, but debugger shows value as Zero. I must have missed
something -- but I am stumped! 

Thanks! 
Laurie Hall 

 
-- 
View this message in context: http://www.nabble.com/L-tf4839203.html#a13844553
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to