Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 16:35:04,655 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
- 16:35:05,321 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
- 16:35:05,550 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) starting
- Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
- 16:35:07,362 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 26) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=ExampleDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
- 16:35:07,374 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 3) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
- 16:35:07,415 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
- 16:35:07,447 INFO [org.xnio] (MSC service thread 1-7) XNIO version 3.3.1.Final
- 16:35:07,464 INFO [org.xnio.nio] (MSC service thread 1-7) XNIO NIO Implementation Version 3.3.1.Final
- 16:35:07,539 INFO [org.jboss.remoting] (MSC service thread 1-7) JBoss Remoting version 4.0.9.Final
- 16:35:07,549 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
- 16:35:07,551 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
- 16:35:07,554 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
- 16:35:07,634 INFO [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
- 16:35:07,635 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
- 16:35:07,657 INFO [org.jboss.as.security] (MSC service thread 1-4) WFLYSEC0001: Current PicketBox version=4.9.2.Final
- 16:35:07,668 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
- 16:35:07,675 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
- 16:35:07,680 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
- 16:35:07,733 INFO [org.jboss.as.connector] (MSC service thread 1-5) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.5.Final)
- 16:35:07,741 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.2.9.Final starting
- 16:35:07,741 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0003: Undertow 1.2.9.Final starting
- 16:35:07,762 INFO [org.jboss.as.naming] (MSC service thread 1-8) WFLYNAM0003: Starting Naming Service
- 16:35:07,776 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
- 16:35:07,800 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0018: Started Driver service with driver-name = h2
- 16:35:08,124 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path /home/menas/WebDev/wildfly-9.0.2.Final/welcome-content
- 16:35:08,145 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0012: Started server default-server.
- 16:35:08,152 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: Host default-host starting
- 16:35:08,380 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTP listener default listening on /127.0.0.1:8080
- 16:35:08,900 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
- 16:35:09,094 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) WFLYDS0013: Started FileSystemDeploymentService for directory /home/menas/WebDev/wildfly-9.0.2.Final/standalone/deployments
- 16:35:09,323 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Final
- 16:35:09,710 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
- 16:35:09,711 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
- 16:35:09,712 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started in 5707ms - Started 203 of 379 services (210 services are lazy, passive or on-demand)
- Connected to server
- [2016-06-16 04:35:10,321] Artifact testJPA:war exploded: Artifact is being deployed, please wait...
- 16:35:10,652 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "testJPA" (runtime-name: "testJPA.war")
- 16:35:12,933 INFO [org.jboss.as.jpa] (MSC service thread 1-4) WFLYJPA0002: Read persistence.xml for jpaPU
- 16:35:13,177 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 58) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'testJPA#jpaPU'
- 16:35:13,212 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 58) HHH000204: Processing PersistenceUnitInfo [
- name: jpaPU
- ...]
- 16:35:13,266 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) WFLYWELD0003: Processing weld deployment testJPA.war
- 16:35:13,322 INFO [org.hibernate.Version] (ServerService Thread Pool -- 58) HHH000412: Hibernate Core {4.3.10.Final}
- 16:35:13,324 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 58) HHH000206: hibernate.properties not found
- 16:35:13,326 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 58) HHH000021: Bytecode provider name : javassist
- 16:35:13,368 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-5) HV000001: Hibernate Validator 5.1.3.Final
- 16:35:13,506 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-5) JNDI bindings for session bean named PersonDAO in deployment unit deployment "testJPA.war" are as follows:
- java:global/testJPA/PersonDAO!PersonDAO
- java:app/testJPA/PersonDAO!PersonDAO
- java:module/PersonDAO!PersonDAO
- java:global/testJPA/PersonDAO
- java:app/testJPA/PersonDAO
- java:module/PersonDAO
- 16:35:14,157 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
- 16:35:14,158 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
- 16:35:14,161 INFO [org.jboss.weld.deployer] (MSC service thread 1-6) WFLYWELD0006: Starting Services for CDI deployment: testJPA.war
- 16:35:14,203 INFO [org.jboss.weld.Version] (MSC service thread 1-6) WELD-000900: 2.2.16 (SP1)
- 16:35:14,240 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) WFLYJCA0018: Started Driver service with driver-name = testJPA.war_com.mysql.jdbc.Driver_5_1
- 16:35:14,240 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = testJPA.war_com.mysql.fabric.jdbc.FabricMySQLDriver_5_1
- 16:35:14,243 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0009: Starting weld service for deployment testJPA.war
- 16:35:14,565 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 58) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'testJPA#jpaPU'
- 16:35:14,652 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 58) HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
- 16:35:14,904 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 58) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
- 16:35:15,008 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 58) HHH000397: Using ASTQueryTranslatorFactory
- 16:35:15,314 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000228: Running hbm2ddl schema update
- 16:35:15,314 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000102: Fetching database metadata
- 16:35:15,318 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000396: Updating schema
- 16:35:15,325 INFO [java.sql.DatabaseMetaData] (ServerService Thread Pool -- 58) HHH000262: Table not found: Person
- 16:35:15,327 INFO [java.sql.DatabaseMetaData] (ServerService Thread Pool -- 58) HHH000262: Table not found: Person
- 16:35:15,329 INFO [java.sql.DatabaseMetaData] (ServerService Thread Pool -- 58) HHH000262: Table not found: Person
- 16:35:15,332 INFO [java.sql.DatabaseMetaData] (ServerService Thread Pool -- 58) HHH000262: Table not found: hibernate_sequence
- 16:35:15,335 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000232: Schema update complete
- 16:35:16,298 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 17) Initializing Mojarra 2.2.12-jbossorg-2 20150729-1131 for context '/testJPA'
- 16:35:18,112 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 17) WFLYUT0021: Registered web context: /testJPA
- 16:35:18,183 INFO [org.jboss.as.server] (management-handler-thread - 2) WFLYSRV0010: Deployed "testJPA" (runtime-name : "testJPA.war")
- [2016-06-16 04:35:18,212] Artifact testJPA:war exploded: Artifact is deployed successfully
- [2016-06-16 04:35:18,212] Artifact testJPA:war exploded: Deploy took 7,891 milliseconds
- 16:35:29,534 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (default task-5) #{registration.addPerson}: java.lang.NullPointerException: javax.faces.FacesException: #{registration.addPerson}: java.lang.NullPointerException
- at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
- at javax.faces.component.UICommand.broadcast(UICommand.java:315)
- at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
- at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
- at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
- at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
- at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
- at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
- at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
- at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
- at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
- at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
- at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
- at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
- at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
- at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
- at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
- at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
- at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
- at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
- at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
- at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
- at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
- at java.lang.Thread.run(Thread.java:745)
- Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
- at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
- at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
- ... 34 more
- Caused by: java.lang.NullPointerException
- at PersonDAO.addPerson(PersonDAO.java:18)
- at Registration.addPerson(Registration.java:21)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:498)
- at com.sun.el.parser.AstValue.invoke(AstValue.java:292)
- at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
- at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
- at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
- at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
- at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
- at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
- at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
- ... 35 more
- 16:35:29,539 ERROR [io.undertow.request] (default task-5) UT005023: Exception handling request to /testJPA/Login.xhtml: javax.servlet.ServletException: java.lang.NullPointerException
- at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
- at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
- at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
- at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
- at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
- at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
- at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
- at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
- at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
- at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
- at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
- at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
- at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
- at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
- at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
- at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
- at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
- at java.lang.Thread.run(Thread.java:745)
- Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
- at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
- at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
- at javax.faces.component.UICommand.broadcast(UICommand.java:315)
- at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
- at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
- at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
- at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
- at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
- at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
- ... 27 more
- Caused by: java.lang.NullPointerException
- at PersonDAO.addPerson(PersonDAO.java:18)
- at Registration.addPerson(Registration.java:21)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:498)
- at com.sun.el.parser.AstValue.invoke(AstValue.java:292)
- at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
- at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
- at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
- at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
- at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
- at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
- at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
- ... 35 more
- @Entity
- @Table(name = "Person")
- public class Person implements Serializable{
- private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue
- @Column(name = "id")
- private int id;
- @Column(name = "nom")
- private String nom;
- @Column(name = "prenom")
- private String prenom;
- public Person() {}
- //setters and getters
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getNom() {
- return nom;
- }
- public void setNom(String nom) {
- this.nom = nom;
- }
- public String getPrenom() {
- return prenom;
- }
- public void setPrenom(String prenom) {
- this.prenom = prenom;
- }
- }
- @Stateless
- public class PersonDAO {
- @PersistenceContext(unitName = "jpaPU")
- private EntityManager em;
- public void addPerson(Person person) {
- em.persist(person);
- }
- }
- @ManagedBean(name="registration", eager = true)
- @SessionScoped
- public class Registration {
- private Person person;
- private PersonDAO mm;
- @PostConstruct
- public void init() {
- person = new Person();
- mm = new PersonDAO();
- }
- public String addPerson() {
- mm.addPerson(person);
- return "Login";
- }
- public Person getPerson() {
- return person;
- }
- public void setPerson(Person person) {
- this.person = person;
- }
- public PersonDAO getMm() {
- return mm;
- }
- public void setMm(PersonDAO mm) {
- this.mm = mm;
- }
- }
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html">
- <h:head>
- <title>Registration</title>
- </h:head>
- <h:body>
- <h1>Registration</h1>
- <h:form>
- <h:message for="loginPanel" style="color:red;" />
- <h:panelGrid columns="2" id="loginPanel">
- Nom :
- <h:inputText id="nom" value="#{registration.person.nom}" />
- Prenom :
- <h:inputSecret id="prenom" value="#{registration.person.prenom}" />
- </h:panelGrid>
- <h:commandButton value="Submit" action="#{registration.addPerson}">
- </h:commandButton>
- </h:form>
- </h:body>
- </html>
- <?xml version="1.0" encoding="UTF-8"?>
- <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
- http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
- <persistence-unit name="jpaPU" transaction-type="JTA">
- <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
- <class>Person</class>
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
- <property name="hibernate.hbm2ddl.auto" value="update"/>
- <!--<property name="javax.persistence.schema-generation.database.action" value="create"/>-->
- <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
- <property name="hibernate.connection.username" value="root"/>
- <property name="hibernate.connection.password" value="root"/>
- <property name="hibernate.connection.url" value="jdbc:mysql://localhost/testJPA"/>
- </properties>
- </persistence-unit>
- </persistence>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement