I am having a weird problem.
I have a simple model called User and UserService.
Here is User.cfc
component persistent=“true” table=“USER” {
//Properties
property name=“userID” column=“USER_ID” hint=“The id for the User” fieldtype=“id” type=“numeric” datatype=“integer” generator=“identity” setter=“false”;
property name=“personID” column=“PERSON_ID”;
property name=“uuid” column=“UUID”;
property name=“dateLastLogin” column=“DATE_LAST_LOGIN”;
property name=“userAgent” column=“USER_AGENT”;
property name=“ipAddress” column=“IP_ADDRESS”;
}
Here is UserService.cfc
component extends=“coldbox.system.orm.hibernate.VirtualEntityService” singleton {
/**
- Constructor
*/
public userService function init(){
super.init(entityName=“user”);
return this;
}
}
Now the problem is that I am unable to get this to save data. I can only get it to insert a new record if it doesn’t exists. Any ideas on what could be wrong?
My code that inserts:
var userS = userService.new();
userS.setPersonID(1);
userService.save(userS);
My code that doesn’t update:
var userS = userService.get(3);
userS.setPersonID(2);
userService.save(userS);
Jeremy R. DeYoung
Phone: 615.261.8201