Reputation: 10468
I'm trying to connect to my local database with user root and password: password. I'm just trying to learn this stuff and it's difficult to get going. I understand that there needs to be a connection provided to the entitymanager and transaction system, but I thought I specified that already in my persistence file. Lastly I'm running standalone jboss so maybe theres something else I have to configure server side, but I feel everything should be configured in my container. Lastly I do not have a hibernate.cfg.xml file since everything is annotated for my entities.
<?xml version="1.0" encoding="UTF-8" ?>
<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"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="persistenceUnit"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/hello" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="password" />
<property name="hbm2ddl.auto" value="create" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>
</persistence-unit>
</persistence>
Edit
13:54:17,474 INFO [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015876: Starting deployment of "hello.war" (runtime-name: "hello.war")
13:54:17,474 INFO [org.jboss.web] (ServerService Thread Pool -- 529) JBAS018224: Unregister web context: /taylor
13:54:17,508 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment taylor.war (runtime-name: taylor.war) in 34ms
13:54:17,578 INFO [org.jboss.as.jpa] (MSC service thread 1-10) JBAS011401: Read persistence.xml for persistenceUnit
13:54:17,604 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
13:54:17,604 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
13:54:17,606 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 533) JBAS011402: Starting Persistence Unit Service 'hello.war#persistenceUnit'
13:54:17,607 INFO [org.hibernate.ejb.Ejb3Configuration] (ServerService Thread Pool -- 533) HHH000204: Processing PersistenceUnitInfo [
name: persistenceUnit
...]
13:54:17,616 WARN [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (ServerService Thread Pool -- 533) HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections
13:54:17,617 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 533) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
13:54:17,617 INFO [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 533) HHH000422: Disabling contextual LOB creation as connection was null
13:54:17,621 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (ServerService Thread Pool -- 533) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
13:54:17,621 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 533) HHH000397: Using ASTQueryTranslatorFactory
13:54:17,630 WARN [org.hibernate.internal.SessionFactoryImpl] (ServerService Thread Pool -- 533) HHH000008: JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()
13:54:17,632 INFO [org.jboss.web] (ServerService Thread Pool -- 536) JBAS018210: Register web context: /helloMan
13:54:17,639 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "taylor.war" (runtime-name: "taylor.war")
13:54:17,639 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "hello.war" (runtime-name : "hello.war")
Upvotes: 3
Views: 5181
Reputation: 108
Well from my experience I could tell few things:
<provider>
tag or hibernate.dialect
property
ever, that might be a problem. hibernate.something.something
or application server specific tags, like jboss.something.something
in persistence.xml
. You are using different
"families" of properties, that might be a problem.Upvotes: 0