Exception : Could not commit transaction
wadhah Dec 22, 2010 12:26 PMHello when i clic on the botton to register i have this exception Could not commit transaction
this is my RegisterBean : 
package org.domain.registration.session;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import org.domain.registration.entity.User.User;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.log.Log;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.international.StatusMessages;
@Stateless
@Name("Register")
public class RegisterBean implements Register {
        @Logger
        private Log log;
        @In
        StatusMessages statusMessages;
        @In
        private User user;
        @PersistenceContext
        private EntityManager em;
        // public void register() {
        // // implement your business logic here
        // log.info("Register.register() action called");
        // statusMessages.add("register");
        // }
        public String register() {
                // List<User> existing = em.createQuery(
                // "select username from users where username=#{user.username}")
                // .getResultList();
                // if (existing.size() == 0) {
                em.persist(user);
                log.info("Registred new user #{user.username}");
                return "/registered.xhtml";
                // } else {
                // FacesMessages.instance()
                // .add("User #{user.username} already exists");
                // return null;
        }
        // }
}
and this is my entity bean 
package org.domain.registration.entity.User;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@Entity
@Name("user")
@Scope(ScopeType.SESSION)
@Table(name = "users")
public class User implements Serializable {
        private static final long serialVersionUID = 1L;
        private String name;
        private String username;
        private String password;
        public User(String name, String username, String password) {
                this.name = name;
                this.username = username;
                this.password = password;
        }
        public User() {
        }
        @Id
        @NotNull
        @Length(min = 5, max = 15)
        public String getUsername() {
                return username;
        }
        public void setUsername(String username) {
                this.username = username;
        }
        @NotNull
        @Length(min = 5, max = 15)
        public String getPassword() {
                return password;
        }
        public void setPassword(String password) {
                this.password = password;
        }
        @Length(max = 20)
        @NotNull
        public String getName() {
                return name;
        }
        public void setName(String name) {
                this.name = name;
        }
}
and this is my register layout 
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:s="http://jboss.com/products/seam/taglib"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:rich="http://richfaces.org/rich"
        xmlns:a="http://richfaces.org/a4j" template="layout/template.xhtml">
        <ui:define name="body">
                <rich:panel>
                        <f:facet name="header">register</f:facet>
                        <h:form id="RegisterForm">
                                <s:validateAll>
                                        <h:panelGrid columns="2">
                  Username: <h:inputText id="username"
                                                        value="#{user.username}" required="true" />
                  Real Name: <h:inputText id="name" value="#{user.name}"
                                                        required="true" />
                  Password: <h:inputSecret id="password"
                                                        value="#{user.password}" required="true" />
                                        </h:panelGrid>
                                </s:validateAll>
                                <h:messages id="messages" />
                                <h:commandButton id="register" value="register!"
                                        action="#{Register.register()}" />
                        </h:form>
                </rich:panel>
        </ui:define>
</ui:composition>
here is the exception :  
Exception during request processing:
Caused by java.lang.IllegalStateException with message: "Could not commit transaction" 
plz i need a help
 
     
    