ejb-jar.xml : User com.polygone.security.auth.ejb.user.LocalUserHome com.polygone.security.auth.ejb.user.LocalUser com.polygone.security.auth.ejb.user.UserBean Container java.lang.String True 2.x User email password email method to find the authenticated users findAll Local Role com.polygone.security.auth.ejb.role.LocalRoleHome com.polygone.security.auth.ejb.role.LocalRole com.polygone.security.auth.ejb.role.RoleBean Container java.lang.String True 2.x Role name name method to find the roles findAll Local Manager com.polygone.security.auth.ejb.manager.ManagerHome com.polygone.security.auth.ejb.manager.Manager com.polygone.security.auth.ejb.manager.ManagerBean Stateless Container User Entity com.polygone.security.auth.ejb.user.LocalUserHome com.polygone.security.auth.ejb.user.LocalUser User Role Entity com.polygone.security.auth.ejb.role.LocalRoleHome com.polygone.security.auth.ejb.role.LocalRole User User-Role user-has-roles Many User roles java.util.Collection role-has-users Many Role User * Required Role * Required Manager * Required jbosscmp-jdbc.xml : java:/DefaultDS mySQL true false true relation-table User insert into user (email, password) values ('someone@polygone.be', 'test'); User email email password password Role insert into role (name) values ('admin'); Role name name User-Role user_roles true false insert into user_roles (user, role) values ('someone@polygone.be', 'admin'); true jboss.xml : User ejb/User Standard CMP 2.x EntityBean false Role ejb/Role Standard CMP 2.x EntityBean false Manager ejb/Manager Standard Stateless SessionBean false server.log : 2004-06-03 07:47:52,853 INFO [org.jboss.management.j2ee.LocalJBossServerDomain] Started jboss.management.local:j2eeType=J2EEDomain,name=Manager 2004-06-03 07:47:52,853 INFO [org.jboss.logging.Log4jService] Started jboss.system:type=Log4jService,service=Logging 2004-06-03 07:47:52,973 INFO [org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread] Running 2004-06-03 07:47:52,973 INFO [org.jboss.web.WebService] Started WebServer with address: 0.0.0.0:8083 2004-06-03 07:47:53,254 INFO [org.jboss.web.WebService] Using RMI server codebase: http://Tokyo:8083/ 2004-06-03 07:47:53,254 INFO [org.jboss.web.WebService] Started jboss:service=WebService 2004-06-03 07:47:53,254 INFO [org.jboss.naming.NamingService] Starting jnp server 2004-06-03 07:47:53,444 INFO [org.jboss.naming.NamingService] Started jnpPort=1099, rmiPort=1098, backlog=50, bindAddress=/0.0.0.0, Client SocketFactory=null, Server SocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076 2004-06-03 07:47:53,454 INFO [org.jboss.naming.NamingService] Listening on port 1099 2004-06-03 07:47:53,464 INFO [org.jboss.naming.NamingService] Started jboss:service=Naming 2004-06-03 07:47:53,464 INFO [org.jboss.naming.JNDIView] Started jboss:service=JNDIView 2004-06-03 07:47:53,464 INFO [org.jboss.security.plugins.SecurityConfig] Started jboss.security:service=SecurityConfig 2004-06-03 07:47:53,514 INFO [org.jboss.security.auth.login.XMLLoginConfig] Started jboss.security:service=XMLLoginConfig 2004-06-03 07:47:53,524 INFO [org.jboss.security.plugins.JaasSecurityManagerService] Started jboss.security:service=JaasSecurityManager 2004-06-03 07:47:53,714 INFO [org.jboss.tm.TransactionManagerService] Started jboss:service=TransactionManager 2004-06-03 07:47:53,774 INFO [org.jboss.invocation.jrmp.server.JRMPInvoker] Started jboss:service=invoker,type=jrmp 2004-06-03 07:47:53,875 INFO [org.jboss.invocation.jrmp.server.JRMPProxyFactory] Started jboss:service=proxyFactory,target=ClientUserTransactionFactory 2004-06-03 07:47:53,885 INFO [org.jboss.invocation.jrmp.server.JRMPProxyFactory] Started jboss:service=proxyFactory,target=ClientUserTransaction 2004-06-03 07:47:53,895 INFO [org.jboss.tm.usertx.server.ClientUserTransactionService] Started jboss:service=ClientUserTransaction 2004-06-03 07:47:53,905 INFO [org.jboss.invocation.local.LocalInvoker] Started jboss:service=invoker,type=local 2004-06-03 07:47:53,965 INFO [org.jboss.invocation.pooled.server.PooledInvoker] Started jboss:service=invoker,type=pooled 2004-06-03 07:47:53,975 INFO [org.jboss.deployment.MainDeployer] Adding deployer: org.jboss.ejb.EJBDeployer@18c3679 2004-06-03 07:47:53,975 INFO [org.jboss.ejb.EJBDeployer] Started jboss.ejb:service=EJBDeployer 2004-06-03 07:47:53,975 INFO [org.jboss.deployment.MainDeployer] Adding deployer: org.jboss.deployment.EARDeployer@6779e6 2004-06-03 07:47:53,975 INFO [org.jboss.deployment.EARDeployer] Started jboss.j2ee:service=EARDeployer 2004-06-03 07:47:53,985 INFO [org.jboss.deployment.MainDeployer] Adding deployer: org.jboss.varia.deployment.BeanShellSubDeployer@659db7 2004-06-03 07:47:53,985 INFO [org.jboss.varia.deployment.BeanShellSubDeployer] Started jboss.scripts:service=BSHDeployer 2004-06-03 07:47:54,115 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/ 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/ant.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/bootstrap.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/catalina.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/commons-beanutils.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/commons-collections.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/commons-digester.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/commons-logging.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/jakarta-regexp-1.3.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/jasper-compiler.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/jasper-runtime.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/naming-common.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/naming-resources.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/servlets-common.jar 2004-06-03 07:47:54,125 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/servlets-default.jar 2004-06-03 07:47:54,245 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/servlets-invoker.jar 2004-06-03 07:47:54,245 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/servlets-webdav.jar 2004-06-03 07:47:54,245 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/tomcat-coyote.jar 2004-06-03 07:47:54,245 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/tomcat-http11.jar 2004-06-03 07:47:54,245 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/tomcat-jk2.jar 2004-06-03 07:47:54,245 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/tomcat-util.jar 2004-06-03 07:47:54,245 INFO [org.jboss.deployment.SARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/tomcat41-service.jar 2004-06-03 07:47:56,228 INFO [STDOUT] Apache Tomcat/4.1.29 2004-06-03 07:47:56,318 INFO [org.apache.coyote.http11.Http11Protocol] Initialisation de Coyote HTTP/1.1 sur le port 80 2004-06-03 07:47:56,318 INFO [org.jboss.web.localhost.Engine] CoyoteConnector Coyote can't register jmx for protocol 2004-06-03 07:47:56,328 INFO [org.apache.coyote.http11.Http11Protocol] Démarrage de Coyote HTTP/1.1 sur le port 80 2004-06-03 07:47:56,328 INFO [org.jboss.web.tomcat.tc4.EmbeddedTomcatService] OK 2004-06-03 07:47:56,328 INFO [org.jboss.deployment.MainDeployer] Adding deployer: org.jboss.web.tomcat.tc4.EmbeddedTomcatService@1c8ef56 2004-06-03 07:47:56,328 INFO [org.jboss.web.tomcat.tc4.EmbeddedTomcatService] Started jboss.web:service=WebServer 2004-06-03 07:47:56,538 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/Projects/polygone/jboss/server/test/deploy/jbossweb-tomcat41.sar/ 2004-06-03 07:47:56,538 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Projects/polygone/jboss/server/test/deploy/jboss-jca.sar 2004-06-03 07:47:56,999 INFO [org.jboss.deployment.XSLSubDeployer] Created templates: org.apache.xalan.templates.StylesheetRoot@1db484d 2004-06-03 07:47:56,999 INFO [org.jboss.deployment.MainDeployer] Adding deployer: org.jboss.resource.RARDeployer@167d7fb 2004-06-03 07:47:56,999 INFO [org.jboss.resource.RARDeployer] Started jboss.jca:service=RARDeployer 2004-06-03 07:47:57,119 INFO [org.jboss.deployment.MainDeployer] Adding deployer: org.jboss.deployment.XSLSubDeployer@118278a 2004-06-03 07:47:57,119 INFO [org.jboss.deployment.XSLSubDeployer] Started jboss.jca:service=ConnectionFactoryDeployer 2004-06-03 07:47:57,119 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/Projects/polygone/jboss/server/test/deploy/jboss-jca.sar 2004-06-03 07:47:57,119 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Projects/polygone/jboss/server/test/deploy/jboss-local-jdbc.rar 2004-06-03 07:47:57,420 INFO [org.jboss.resource.RARDeployer] nested deployment: file:/C:/Projects/polygone/jboss/server/test/tmp/deploy/tmp57329jboss-local-jdbc.rar-contents/jboss-local-jdbc.jar 2004-06-03 07:47:57,450 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/Projects/polygone/jboss/server/test/deploy/jboss-local-jdbc.rar 2004-06-03 07:47:57,450 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Projects/polygone/jboss/server/test/deploy/mysql-ds.xml 2004-06-03 07:47:57,760 INFO [org.jboss.resource.connectionmanager.RARDeployment] Started jboss.jca:service=ManagedConnectionFactory,name=DefaultDS 2004-06-03 07:47:57,890 INFO [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Started jboss.jca:service=ManagedConnectionPool,name=DefaultDS 2004-06-03 07:47:57,910 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/Projects/polygone/jboss/server/test/deploy/mysql-ds.xml 2004-06-03 07:47:57,910 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Projects/polygone/jboss/server/test/deploy/sqlexception-service.xml 2004-06-03 07:47:58,021 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/Projects/polygone/jboss/server/test/deploy/sqlexception-service.xml 2004-06-03 07:47:58,021 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Projects/polygone/jboss/server/test/deploy/transaction-service.xml 2004-06-03 07:47:58,051 INFO [org.jboss.resource.connectionmanager.CachedConnectionManager] Started jboss.jca:service=CachedConnectionManager 2004-06-03 07:47:58,061 INFO [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.DefaultDS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'java:/DefaultDS' 2004-06-03 07:47:58,061 INFO [org.jboss.resource.connectionmanager.TxConnectionManager] Started jboss.jca:service=LocalTxCM,name=DefaultDS 2004-06-03 07:47:58,071 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/Projects/polygone/jboss/server/test/deploy/transaction-service.xml 2004-06-03 07:47:58,071 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Projects/polygone/jboss/server/test/deploy/test.ear 2004-06-03 07:47:58,141 INFO [org.jboss.deployment.EARDeployer] Init J2EE application: file:/C:/Projects/polygone/jboss/server/test/deploy/test.ear 2004-06-03 07:47:59,503 INFO [org.jboss.ejb.EjbModule] Deploying User 2004-06-03 07:47:59,513 INFO [org.jboss.ejb.EjbModule] Deploying Role 2004-06-03 07:47:59,543 INFO [org.jboss.ejb.EjbModule] Deploying Manager 2004-06-03 07:48:00,764 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.User] Initializing CMP plugin for User 2004-06-03 07:48:00,774 INFO [org.jboss.ejb.plugins.EntityInstancePool] Started jboss.j2ee:jndiName=ejb/User,plugin=pool,service=EJB 2004-06-03 07:48:00,774 INFO [org.jboss.ejb.EntityContainer] Started jboss.j2ee:jndiName=ejb/User,service=EJB 2004-06-03 07:48:00,774 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.Role] Initializing CMP plugin for Role 2004-06-03 07:48:01,205 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.User] Insert Entity SQL: INSERT INTO User (email, password) VALUES (?, ?) 2004-06-03 07:48:01,205 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.User] Entity Exists SQL: SELECT COUNT(*) FROM User WHERE email=? 2004-06-03 07:48:01,205 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.User] entity-command: [commandName=default,commandClass=class org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand,attributes={}] 2004-06-03 07:48:01,215 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.User] Remove SQL: DELETE FROM User WHERE email=? 2004-06-03 07:48:01,235 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.User] Executing SQL: CREATE TABLE User (email VARCHAR(250) BINARY NOT NULL, password VARCHAR(250) BINARY, CONSTRAINT pk_User PRIMARY KEY (email)) 2004-06-03 07:48:01,305 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.User] Created table 'User' successfully. 2004-06-03 07:48:01,305 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.User] issuePostCreateSQL::sql: [insert into user (email, password) values ('someone@polygone.be', 'test');] on table User 2004-06-03 07:48:01,305 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.User] Executing SQL: insert into user (email, password) values ('someone@polygone.be', 'test'); 2004-06-03 07:48:01,305 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.User] Issued SQL [insert into user (email, password) values ('someone@polygone.be', 'test');] successfully. 2004-06-03 07:48:01,315 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.User#findByPrimaryKey] SQL: SELECT email FROM User WHERE email=? 2004-06-03 07:48:01,325 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.User] Added findByPrimaryKey query command for local home interface 2004-06-03 07:48:01,325 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.User#findAll] EJB-QL: select object (user) from User user 2004-06-03 07:48:01,405 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.User#findAll] SQL: SELECT t0_user.email FROM User t0_user 2004-06-03 07:48:01,756 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Role] Insert Entity SQL: INSERT INTO Role (name, description) VALUES (?, ?) 2004-06-03 07:48:01,756 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Role] Entity Exists SQL: SELECT COUNT(*) FROM Role WHERE name=? 2004-06-03 07:48:01,756 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.Role] entity-command: [commandName=default,commandClass=class org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand,attributes={}] 2004-06-03 07:48:01,756 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.Role] Remove SQL: DELETE FROM Role WHERE name=? 2004-06-03 07:48:01,756 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] Executing SQL: CREATE TABLE Role (name VARCHAR(250) BINARY NOT NULL, description VARCHAR(250) BINARY, CONSTRAINT pk_Role PRIMARY KEY (name)) 2004-06-03 07:48:01,826 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] Created table 'Role' successfully. 2004-06-03 07:48:01,826 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] issuePostCreateSQL::sql: [insert into role (name, description) values ('admin', 'Administrator');] on table Role 2004-06-03 07:48:01,826 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] Executing SQL: insert into role (name, description) values ('admin', 'Forum administrator'); 2004-06-03 07:48:01,826 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] Issued SQL [insert into role (name, description) values ('admin', 'Forum administrator');] successfully. 2004-06-03 07:48:01,826 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] Executing SQL: CREATE TABLE user_roles (Role VARCHAR(250) BINARY NOT NULL, User VARCHAR(250) BINARY NOT NULL, CONSTRAINT pk_user_roles PRIMARY KEY (Role, User)) 2004-06-03 07:48:01,876 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] Created table 'user_roles' successfully. 2004-06-03 07:48:01,876 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] issuePostCreateSQL::sql: [insert into user (email, password) values ('someone@polygone.be', 'test');] on table user_roles 2004-06-03 07:48:01,876 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] Executing SQL: insert into user (email, password) values ('someone@polygone.be', 'test'); 2004-06-03 07:48:01,876 WARN [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Role] Issuing sql insert into user (email, password) values ('someone@polygone.be', 'test'); failed: java.sql.SQLException: Invalid argument value, message from server: "Duplicate entry 'someone@polygone.be' for key 1" 2004-06-03 07:48:01,906 ERROR [org.jboss.ejb.EntityContainer] Starting failed org.jboss.deployment.DeploymentException: Error while issuing sql in post-table-create; - nested throwable: (java.sql.SQLException: Invalid argument value, message from server: "Duplicate entry 'someone@polygone.be' for key 1") at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.issuePostCreateSQL(JDBCStartCommand.java:392) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:154) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:484) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:388) at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152) at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:342) at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976) at $Proxy14.start(Unknown Source) at org.jboss.system.ServiceController.start(ServiceController.java:394) at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177) at $Proxy21.start(Unknown Source) Comments : Default value insertion works well for both beans but fails for the relation I got an SQLException : Duplicate entry 'someone@polygone.be' for key 1" When I read the server.log file, I see that a wrong sql statement is chosen : issuePostCreateSQL::sql: [insert into user (email, password) values ('someone@polygone.be', 'test');] on table User issuePostCreateSQL::sql: [insert into role (name, description) values ('admin', 'Administrator');] on table Role issuePostCreateSQL::sql: [ insert into user (email, password) values ('someone@polygone.be', 'test'); ] on table user_roles Why does the server choose the sql statement defined for the User bean (insert into user (email, password) values ('someone@polygone.be', 'test')) instead the statement defined for the relationship (insert into user_roles (user, role) values ('someone@polygone.be', 'admin')) ? In that situation, it's normal that I got this SQLException because the info has already been inserted in the user table.