java - Tables in SQL Server database are not auto-created -
i'm trying auto-create tables java in database on microsoft sql server 2012. i'm using jpa , there persistence.xml :
<?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="pu" transaction-type="jta"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <jta-data-source>ds</jta-data-source> <class>msg.message</class> <class>msg.response</class> <properties> <property name="hibernate.connection.driver_class" value="com.microsoft.jdbc.sqlserver.sqlserverdriver"/> <property name="hibernate.dialect" value="org.hibernate.dialect.sqlserverdialect"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.hbm2ddl.auto" value="create"/> </properties> </persistence-unit>
jdbc connection pool on glassfish ping succeed (additional properties
url: jdbc:sqlserver://127.0.0.1;databasename=test;instancename=sqlexpress; user: user password: password portnumber: 1433 )
header of message.java
@entity @table(name = "message", schema = "xxx_msg") public class message implements serializable { @id @basic(optional = false) @generatedvalue(strategy = generationtype.auto) @column(name = "id") private integer id; @joincolumn(name = "sender_id", referencedcolumnname = "id") @manytoone private person senderid;
there no errors on build or deploy, database no tables created
fixed
i had create schemas microsoft sql server management studio first (my database -> new query -> create schema xxx_msg )
Comments
Post a Comment