为什么休眠不创建表?是真的吗 由于Scala,因为我从来没有遇到过Java这样的问题? (用户名和密码被隐藏)
Queue.scala
package model.entity
import javax.persistence._
import org.hibernate.annotations.GenericGenerator
@Entity
@Table(schema = "queuebot", name = "queue")
class Queue {
def this(id: Int) = {
this()
queueId = id
}
@Id
@GenericGenerator(name = "gen", strategy = "increment")
@GeneratedValue(generator = "gen")
@Column(name = "queueId", unique = true)
var queueId: Int = _
@Column(name = "queueName")
var queueName: String = _
}
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE hibernate-configuration SYSTEM "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- JDBC Database connection settings -->
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL82Dialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/queuebot</property>
<property name="hibernate.connection.username"></property>
<property name="hibernate.connection.password"></property>
<!-- JDBC connection pool settings ... using built-in test pool -->
<property name="connection.pool_size">1</property>
<!-- Select our SQL dialect -->
<property name="dialect">org.hibernate.dialect.PostgreSQL95Dialect</property>
<!-- Echo the SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create-drop</property>
<mapping class="model.entity.Queue" />
</session-factory>
</hibernate-configuration>