Commit 708de524 by Juho Juopperi

persistence changes

1 parent fc9271d2
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd"> <persistence version="1.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_1_0.xsd">
<persistence-unit name="BortalDb"> <persistence-unit name="BortalDb">
<jta-data-source>jdbc/bortalDatabase</jta-data-source> <jta-data-source>jdbc/bortal</jta-data-source>
<properties> <properties>
<property name="eclipselink.ddl-generation" value="create-tables"/> <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="database"/> <property name="eclipselink.ddl-generation.output-mode" value="database"/>
</properties> </properties>
</persistence-unit> </persistence-unit>
......
...@@ -24,6 +24,7 @@ import javax.persistence.Version; ...@@ -24,6 +24,7 @@ import javax.persistence.Version;
@Table(name = "locations") @Table(name = "locations")
@NamedQueries({ @NamedQueries({
@NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"), @NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"),
@NamedQuery(name = "Location.findByLocationName", query = "SELECT l FROM Location l WHERE l.name = :name") }) @NamedQuery(name = "Location.findByLocationName", query = "SELECT l FROM Location l WHERE l.name = :name") })
public class Location implements ModelInterface { public class Location implements ModelInterface {
......
...@@ -52,22 +52,23 @@ public class User implements ModelInterface { ...@@ -52,22 +52,23 @@ public class User implements ModelInterface {
@Id @Id
@GeneratedValue(strategy=GenerationType.IDENTITY) @GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "users_id", nullable = false) @Column(name = "users_id", nullable = false)
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Integer id; private Integer id;
@Column(name = "created", nullable = false) @Column(name = "created", nullable = false, columnDefinition = "timestamptz default now()")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar created; private Calendar created;
@Column(name = "active", nullable = false) @Column(name = "active", nullable = false, columnDefinition = "boolean default true")
private boolean active; private boolean active;
@Column(name = "password") @Column(name = "password")
private String password; private String password;
@Column(name = "lastname", nullable = false) @Column(name = "lastname")
private String lastname; private String lastname;
@Column(name = "firstnames", nullable = false) @Column(name = "firstnames")
private String firstnames; private String firstnames;
@Column(name = "birthday") @Column(name = "birthday")
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!