Hibernate can now actually create tables.

This commit is contained in:
neviyn 2018-09-21 11:11:49 +01:00
parent a368677573
commit dec5f4252b
3 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,7 @@ database:
# any properties specific to your JDBC driver: # any properties specific to your JDBC driver:
properties: properties:
foreign_keys: true foreign_keys: true
hibernate.hbm2ddl.auto: create
server: server:
rootPath: /api/ rootPath: /api/

View File

@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull; import lombok.NonNull;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import java.io.Serializable; import java.io.Serializable;
@ -19,6 +20,6 @@ class BaseEntity implements Serializable {
@NonNull @NonNull
@JsonProperty @JsonProperty
@Id @Id
@GeneratedValue @GeneratedValue(strategy = GenerationType.IDENTITY)
private long id; private long id;
} }

View File

@ -12,7 +12,7 @@ public class SiteDao extends AbstractDAO<Site> {
} }
public List<Site> listAll(){ public List<Site> listAll(){
return list(criteriaQuery()); return currentSession().createQuery("from Site", Site.class).list();
} }
public Site get(long id){ public Site get(long id){