Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring hibernate/jpa automatic table generation
    primarykey
    data
    text
    <p>hello am duin a spring data jpa application and i want de table to generated automatically ...the test run successfully but no table is generated in database.</p> <p>below are my configuration files</p> <p>pesistence.xml</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;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"&gt; &lt;persistence-unit name="purchaseHistory" transaction-type="RESOURCE_LOCAL"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;properties&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /&gt; &lt;property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/itopupdb" /&gt; &lt;property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="hibernate.connection.username" value="root" /&gt; &lt;property name="hibernate.connection.password" value="" /&gt; &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p>test-db-config.xml</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd "&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt; &lt;/bean&gt; &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt; &lt;property name="persistenceUnitName" value="purchaseHistory" /&gt; &lt;/bean&gt; &lt;bean id="jpdDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/&gt; &lt;jpa:repositories base-package="com.dreamoval.itopup.transactions.repository"/&gt; &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; &lt;/beans&gt; </code></pre> <p>PurchaseHistoryTest.java</p> <pre><code> package com.dreamoval.itopup.transactions.model; import com.dreamoval.itopup.transactions.repository.PurchaseHistoryRepository; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; /** * * @author ADDICO */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:META-INF/test-db-config.xml") @Transactional public class PurchaseHistoryTest { private PurchaseHistoryRepository historyRepository; public PurchaseHistoryTest() { } @Test public void GenerateDatabaseTest(){ Assert.assertTrue(true); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload