What is wrong with this code?
When I post a tweet, the page stays blank, when I check the database, the tweets are there but the userId key is null, it's not a naming issue I named it user_id but is always null, I don't know what the problem is, this should work, no?
#Entity
public class Tweets {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
#Column(name = "tweet", length = 500)
private String tweet;
#ManyToOne
#JoinColumn(name = "userId")
private User user;
public Tweets() {
}
public Tweets(String tweet, User user) {
this.setTweet(tweet);
this.setUser(user);
}
public long getId() {
return id;
}
/*
public void setId(long id) {
this.id = id;
}
*/
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getTweet() {
return tweet;
}
public void setTweet(String tweet) {
this.tweet = tweet;
}
}
User entity:
#Entity
#Table(name = "usr", indexes = { #Index(columnList = "email", unique = true) })
// using usr because in may conflict with the name of the class
public class User {
public static final int EMAIL_MAX = 250;
public static final int NAME_MAX = 50;
/*
* public static enum Role {
*
* UNVERIFIED, BLOCKED, ADMINISTRATOR
*
* }
*/
// primary key long, needs to be annotated with #Id
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
// add columns
#Column(nullable = false, length = EMAIL_MAX)
private String email;
#Column(nullable = false, length = NAME_MAX)
private String name;
// no length, the password will be encrypted to some longer value than the
// user enters
#Column(nullable = false)
private String password;
#OneToMany(fetch = FetchType.EAGER, mappedBy = "user", cascade=CascadeType.ALL)
private List<Tweets> tweets;
public List<Tweets> getTweets() {
return tweets;
}
public void setTweets(List<Tweets> tweets) {
this.tweets = tweets;
}
public void setUsername(String username) {
this.username = username;
}
#Column(nullable = false)
private String username;
/*
* //email verification code
*
* #Column(length = 16) private String verificationCode;
*
* public String getVerificationCode() { return verificationCode; }
*
* public void setVerificationCode(String verificationCode) {
* this.verificationCode = verificationCode; }
*
*
* #ElementCollection(fetch = FetchType.EAGER) private Set<Role> roles = new
* HashSet<Role>();
*
*
*
* public Set<Role> getRoles() { return roles; }
*
* public void setRoles(Set<Role> roles) { this.roles = roles; }
*/
public long getId() {
return id;
}
/*
public void setId(long id) {
this.id = id;
}
*/
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isEditable() {
User loggedIn = MyTools.getSessionUser();
if (loggedIn == null) {
return false;
}
return loggedIn.getId() == id;
}
public String getUsername() {
return username;
}
}
Related
whenever I try to add something into my table documents using the userId as a parameter I get this error message in postman using this "localhost:9293/SpringMVC/servlet/documents/add?userId=2"
could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement
I already have a user created with the userId=2
my user.java
#Entity(name="user")
public class User implements Serializable , UserDetails {
/**
*
*/
private static final long serialVersionUID = 1L;
private User user;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private int userId;
private String name;
private int phone_number;
private String email;
private String password;
private String address;
private boolean verified;
private boolean subscribed;
private String idStrype;
//#Column(nullable = true, length = 64)
//private String documents;
#ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
#JsonIgnore
#JsonBackReference
private Role role;
#OneToMany(cascade = CascadeType.PERSIST,mappedBy="user",fetch=FetchType.LAZY)
//#JsonManagedReference
private Set<Ad> ads;
#OneToOne(cascade = CascadeType.ALL, mappedBy = "user")
private Documents documents;
/*#OneToMany(cascade = CascadeType.PERSIST,mappedBy="user",fetch=FetchType.LAZY)
//#JsonManagedReference
private Set<Insurance> insurances;*/
#OneToMany(cascade = CascadeType.PERSIST,mappedBy="user",fetch=FetchType.LAZY)
//#JsonManagedReference
private Set<Offer> offers;
#OneToMany(cascade = CascadeType.PERSIST,mappedBy="user",fetch=FetchType.LAZY)
//#JsonManagedReference
private Set<Contract> contracts;
#OneToMany(cascade = CascadeType.PERSIST,mappedBy="user",fetch=FetchType.LAZY)
//#JsonManagedReference
private Set<Reclamation> reclamations;
public String getIdStrype() {
return idStrype;
}
public void setIdStrype(String idStrype) {
this.idStrype = idStrype;
}
/**
* #return the userId
*/
public int getUserId() {
return userId;
}
/**
* #param userId the userId to set
*/
public void setUserId(int userId) {
this.userId = userId;
}
/**
* #return the name
*/
public String getName() {
return name;
}
/**
* #param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* #return the phone_number
*/
public int getPhone_number() {
return phone_number;
}
/**
* #param phone_number the phone_number to set
*/
public void setPhone_number(int phone_number) {
this.phone_number = phone_number;
}
/**
* #return the email
*/
public String getEmail() {
return email;
}
/**
* #param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
my documents.java
#Entity
#Table(name= "document")
public class Documents implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy= GenerationType.IDENTITY)
#Column(name= "id")
private int id;
#Column(name="fichedepaie")
private String fichedepaie;
#Column(name="piecedidentite")
private String piecedidentite;
#Column(name="lettredengagement")
private String lettredengagement;
#Column(name="cautionnement")
private String cautionnement;
#OneToOne
private User user;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFichedepaie() {
return fichedepaie;
}
public void setFichedepaie(String fichedepaie) {
this.fichedepaie = fichedepaie;
}
public String getPiecedidentite() {
return piecedidentite;
}
public void setPiecedidentite(String piecedidentite) {
this.piecedidentite = piecedidentite;
}
public String getLettredengagement() {
return lettredengagement;
}
public void setLettredengagement(String lettredengagement) {
this.lettredengagement = lettredengagement;
}
public String getCautionnement() {
return cautionnement;
}
public void setCautionnement(String cautionnement) {
this.cautionnement = cautionnement;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Documents(String fichedepaie, String piecedidentite, String lettredengagement, String cautionnement) {
super();
this.fichedepaie = fichedepaie;
this.piecedidentite = piecedidentite;
this.lettredengagement = lettredengagement;
this.cautionnement = cautionnement;
}
public Documents() {
super();
}
}
my documentsService.java
#Override
public Documents addDocuments(Documents d, int userid) {
// TODO Auto-generated method stub
d.setUser(userrepo.findById(userid).get());
docrepo.save(d);
return d;
}
my documentsController.java
#RestController
#RequestMapping("/documents")
public class DocumentsController {
#Autowired
DocumentsService docserv ;
#Autowired
UserRepository userrepo;
#PostMapping("/add")
private Documents addDocuments(#RequestBody Documents docs, #RequestParam("userId") int userId)
{
docserv.addDocuments(docs,userId);
return docs;
}
I think, you are missing #JoinColumn(name = "user_id") annotation in your Documents entity
#OneToOne
#JoinColumn(name = "user_id")
private User user;
Please note that user_id must be the foreign key in your document table if it is the different field, then use that one.
I have entity Account, Role, AccountRole.
#Entity
public class Account {
#Id
private String loingId;
private String username;
private String password;
private String email;
private boolean enable;
#OneToMany(mappedBy = "account", orphanRemoval = true)
private List<AccountRole> accountRoles = new ArrayList<>();
public String getLoingId() {
return loingId;
}
public void setLoingId(String loingId) {
this.loingId = loingId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public boolean isEnable() {
return enable;
}
public void setEnable(boolean enable) {
this.enable = enable;
}
public List<AccountRole> getAccountRoles() {
return accountRoles;
}
public void setAccountRoles(List<AccountRole> accountRoles) {
this.accountRoles = accountRoles;
}
public void addAccountRoles(AccountRole accountRoles) {
if (this.accountRoles == null){
this.accountRoles = new ArrayList<>();
}
this.accountRoles.add(accountRoles);
accountRoles.setAccount(this);
}
public void removeAccountRoles(){
this.accountRoles = null;
}
}
#Entity
public class Role {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private String description;
private boolean enable;
#OneToMany(mappedBy = "role")
private List<AccountRole> accountRoles = new ArrayList<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isEnable() {
return enable;
}
public void setEnable(boolean enable) {
this.enable = enable;
}
public List<AccountRole> getAccountRoles() {
return accountRoles;
}
public void setAccountRoles(List<AccountRole> accountRoles) {
this.accountRoles = accountRoles;
}
}
#Entity
public class AccountRole implements Serializable{
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
#ManyToOne
#JoinColumn(name = "account_id")
private Account account;
#ManyToOne
#JoinColumn(name = "role_id")
private Role role;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
}
To create account with role is OK.
There is a problem in update.
I want to delete the existing Role and only add the changed Role when the Role of the Account is changed. However, existing data is not deleted from the AccoutRole table.
How can I solve the problem?
springBootVersion = '1.5.3.RELEASE'
java 1.8
gradle dependencies
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
testCompile('org.springframework.boot:spring-boot-starter-test')
runtime ('org.mariadb.jdbc:mariadb-java-client')
}
A couple of ideas:
Thought 1: Try using cascade
Yes, JPA 2.0 should handle this with orphanRemoval = true, but let's just see if that works. I think that it is not because you aren't creating an orphan here. The mapping is still "valid" from a relational perspective.
#OneToMany(mappedBy = "account", cascade = CascadeType.ALL) // or CascadeType.REMOVE
private List<AccountRole> accountRoles = new ArrayList<>();
Thought 2: Try setting the account roles to an empty hashmap instead first:
account.setAccountRoles(new HashMap<AccountRole>());
account.getAccountRoles().add(accountRole);;
I'm using servlets with JPA+Hibernate). I don't understand the error, unless I've tried other solutions suggested in this forum. In fact, I don't want to store the UserAccount class as an entity; but I just want to declare it in the Utilisateur class (the Ids of the Utilisateur class are declared in the useraccount class).
My code :
#Entity
#Table(name = "utilisateur")
public class Utilisateur implements Serializable {
#Id
private UserAccount userAccount;
private Civility civility;
private Address address;
private Contact contact;
#Column(name = "sessions")
private List<String> sessions;
#Column(name = "particularRules")
private boolean particularRules;
public Utilisateur(UserAccount pAccount, Civility pCivility,
Address pAddress, Contact pContact, List<String>
pSessions,
boolean particularRules) {
this.userAccount = pAccount;
this.civility = pCivility;
this.address = pAddress;
this.contact = pContact;
this.sessions = pSessions;
this.particularRules = particularRules;
}
public Civility getCivility() {
return civility;
}
public void setCivility(Civility civility) {
this.civility = civility;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Contact getContact() {
return contact;
}
public void setContact(Contact contact) {
this.contact = contact;
}
public boolean isParticularRules() {
return particularRules;
}
public void setParticularRules(boolean particularRules) {
this.particularRules = particularRules;
}
public UserAccount getUserAccount() {
return userAccount;
}
public void setUserAccount(UserAccount userAccount) {
this.userAccount = userAccount;
}
public List<String> getSessions() {
return sessions;
}
public void setSessions(List<String> sessions) {
this.sessions = sessions;
}
}
#Embeddable
#Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class UserAccount implements Serializable {
public UserAccount() {
}
public UserAccount(String pId, String pEmail, String pwsd, Date pCreaDate, Date pLastModDate) {
this.identifier = pId;
this.email = pEmail;
this.password = pwsd;
this.creationDate = pCreaDate;
this.lastModificationDate = pLastModDate;
}
#OneToOne(mappedBy = "userAccount", cascade = CascadeType.ALL,
fetch = FetchType.EAGER, orphanRemoval = true, targetEntity =
Utilisateur.class)
private Utilisateur user;
#Column(name = "creationDate")
#Temporal(javax.persistence.TemporalType.DATE)
private Date creationDate;
#Column(name = "lastModificationDate")
#Temporal(javax.persistence.TemporalType.DATE)
private Date lastModificationDate;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "identifier", nullable = false)
private String identifier;
#Column(name = "email")
private String email;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "password", nullable = false)
private String password;
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public Date getLastModificationDate() {
return lastModificationDate;
}
public void setLastModificationDate(Date lastModificationDate) {
this.lastModificationDate = lastModificationDate;
}
public Utilisateur getUser() {
return user;
}
public void setUser(Utilisateur user) {
this.user = user;
}
}
You must use an Embedded Primary Key.
See the answer to this question here in Stackoverflow How to create and handle composite primary key in JPA.
Best regards!
It may occur when Embedded Primary Key contains #EmbeddedId. Sub-composite key should be annotated with #Embedded instead.
i have this error nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): app.Spring.domain.UserDetails.
I now have this user table and in profile i want to edit this UserDetails.
i was trying with GeneratedValue but this doing random id that not associate with user_id also checked generator but this method also dont work.There is so many options so i am lost now.Can someone show some method to mapp this two entities?
User
#Entity
#Table(name = "USERS")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue
#Column(name = "user_id")
private Long user_id;
#NotBlank
#Size(min = 5, max = 20)
private String username;
#NotBlank
#Size(min = 8, max = 20)
private String password;
private String email;
private String name;
private String surname;
#OneToOne(cascade = CascadeType.ALL)
#PrimaryKeyJoinColumn
private UserDetails userDetail;
public User() {
}
public User(Long user_id, String username, String email, String name,
String surname, UserDetails userDetail, String password) {
super();
this.user_id = user_id;
this.username = username;
this.email = email;
this.name = name;
this.surname = surname;
this.userDetail = userDetail;
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public Long getUser_id() {
return user_id;
}
public final void setUser_id(Long user_id) {
this.user_id = user_id;
}
public void setId(Long user_id) {
this.user_id = user_id;
}
#Column(name = "username")
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
#Column(name = "password")
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
User_Details
#Entity
#Table(name = "user_address")
public class UserDetails {
public UserDetails() {
super();
// TODO Auto-generated constructor stub
}
#Id
#Column(name = "user_id")
private Long id;
private String adres1;
private String adres2;
private String city;
private String postcode;
#OneToOne
#PrimaryKeyJoinColumn
private User user;
public UserDetails(Long id, String adres1, String adres2, String city,
String postcode, User user) {
super();
this.id = id;
this.adres1 = adres1;
this.adres2 = adres2;
this.city = city;
this.postcode = postcode;
this.user = user;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getAdres1() {
return adres1;
}
public void setAdres1(String adres1) {
this.adres1 = adres1;
}
public String getAdres2() {
return adres2;
}
public void setAdres2(String adres2) {
this.adres2 = adres2;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public void setId(Long id) {
this.id = id;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
LOGIC
#RequestMapping(value = "/userDetails", method = RequestMethod.GET)
public String showForm(Model model,
#RequestParam(value = "id", defaultValue = "-1") Long id,
HttpSession session) {
app.Spring.domain.UserDetails va = (id > 0) ? reg.getAdress(id)
: new UserDetails();
model.addAttribute("detal", va);
return "userDetails";
}
#RequestMapping(value = "/userDetails", method = RequestMethod.POST)
public String submit(Model model, #ModelAttribute("detal") UserDetails va,
BindingResult result) {
validator.validate(va, result);
if (result.hasErrors()) {
return "userDetails";
}
reg.saveOrUpdateUserDetails(va);
return "profile";
}
I don't know how to do this with annotations but you might try to manually assign the (hopefully then already present) id fetched from user in the UserDetails entity in the #PrePresist annotated method.
User
#Entity
#Table(name = "USERS")
public class User implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue
#Column(name = "user_id")
private Long user_id;
#NotBlank
#Size(min = 5, max = 20)
private String username;
#NotBlank
#Size(min = 8, max = 20)
private String password;
private String email;
private String name;
private String surname;
#OneToOne(mappedBy = "user")
private UserDetails userDetail;
User_detail
#Entity
#Table(name = "user_address")
public class UserDetails {
public UserDetails() {
super();
// TODO Auto-generated constructor stub
}
#Id
private Long id;
private String adres1;
private String adres2;
private String city;
private String postcode;
#OneToOne
#JoinColumn(name = "user_id")
private User user;
ive been working on this for a while and can't seem to figure it out except that at some point it was working as was intended. I have two objects, a User which can be associatted with multiple addresses. Saving a new user and address together works just fine, but when i try to add a new address to an existing User i get an error about duplicate primary keys for User table. I guess it has something to do with the configuration in hibernate trying both unidirectional and bidirectional.
Below are any relevant files. Thanks of your help!
User.java
#Entity
#Table(name = "users")
public class Users implements Serializable {
private static final long serialVersionUID = -5699491123012997265L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private int idusers;
#NotBlank(groups = { PersistenceValidationGroup.class, FormValidationGroup.class })
#Size(min = 5, max = 15, groups = { PersistenceValidationGroup.class, FormValidationGroup.class })
#Pattern(regexp = "^\\w{5,}$", groups = { PersistenceValidationGroup.class, FormValidationGroup.class })
private String username;
#NotBlank(groups = { PersistenceValidationGroup.class, FormValidationGroup.class })
#Pattern(regexp = "^\\S+$", groups = { PersistenceValidationGroup.class, FormValidationGroup.class })
#Size(min = 8, max = 15, groups = { FormValidationGroup.class })
private String password;
private boolean enabled = false;
private String authority;
#Size(max = 25, groups = { PersistenceValidationGroup.class, FormValidationGroup.class })
private String name;
#Size(min = 10, max = 10, groups = { PersistenceValidationGroup.class, FormValidationGroup.class })
private String phoneNo;
#OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL })
#JoinColumn(name = "idaddresses")
private Set<Addresses> addresses;
// CONSTRUCTORS
public Users() {
}
public Users(String username, String password, boolean enabled,
String authority, String name, String phoneNo,
Set<Addresses> addresses) {
this.username = username;
this.password = password;
this.enabled = enabled;
this.authority = authority;
this.name = name;
this.phoneNo = phoneNo;
this.addresses = addresses;
}
// GETTERS AND SETTERS
public int getIdUsers() {
return idusers;
}
public void setIdusers(int idusers) {
this.idusers = idusers;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getAuthority() {
return authority;
}
public void setAuthority(String authority) {
this.authority = authority;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getIdusers() {
return idusers;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
public Set<Addresses> getAddresses() {
return addresses;
}
public void setAddresses(Set<Addresses> addresses) {
this.addresses = addresses;
}
public void addAddress(Addresses addresses) {
if (this.addresses == null) {
this.addresses = new HashSet<Addresses>();
}
addresses.setUsers(this);
this.addresses.add(addresses);
}
}
Addresses.java
#Entity
#Table(name = "addresses")
public class Addresses implements Serializable {
private static final long serialVersionUID = -1239830513656245466L;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private int idaddresses;
#NotBlank
#Size(min = 5, max = 45)
private String street1;
#NotBlank
#Size(min = 5, max = 45)
private String street2;
#Size(min = 0, max = 200)
private String special;
private String apt;
private String city;
private String state;
#ManyToOne
#JoinColumn(name = "idusers")
private Users users;
// CONSTRUCTORS
public Addresses() {
}
public Addresses(String street1, String street2, String special,
String apt, String city, String state, Users users) {
this.street1 = street1;
this.street2 = street2;
this.special = special;
this.apt = apt;
this.city = city;
this.state = state;
this.users = users;
}
// GETTERS AND SETTERS
public int getIdaddresses() {
return idaddresses;
}
public void setIdaddresses(int idaddresses) {
this.idaddresses = idaddresses;
}
public String getStreet1() {
return street1;
}
public void setStreet1(String street1) {
this.street1 = street1;
}
public String getStreet2() {
return street2;
}
public void setStreet2(String street2) {
this.street2 = street2;
}
public String getSpecial() {
return special;
}
public void setSpecial(String special) {
this.special = special;
}
public String getApt() {
return apt;
}
public void setApt(String apt) {
this.apt = apt;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Users getUsers() {
return users;
}
public void setUsers(Users users) {
this.users = users;
}
}
Part of flow that calls method
<view-state id="newAddress" model="address">
<transition on="addNewAddress" to="customerReady" />
<on-exit>
<evaluate expression="address.street1 = requestParameters.street1"></evaluate>
<evaluate expression="address.street2 = requestParameters.street2"></evaluate>
<evaluate expression="address.apt = requestParameters.apt"></evaluate>
<evaluate expression="address.city = requestParameters.city"></evaluate>
<evaluate expression="address.special = requestParameters.special"></evaluate>
<evaluate expression="address.city = requestParameters.city"></evaluate>
<evaluate expression="address.state = 'NY'"></evaluate>
<evaluate expression="user.addAddress(address)"></evaluate>
<evaluate expression="usersService.update(user)"></evaluate>
</on-exit>
</view-state>
userService.update(user) sends you to dao
public void update(Users users) {
session().saveOrUpdate(users);
}