Ebean Chnages
This commit is contained in:
parent
7721797946
commit
5022d3fbf9
@ -1,59 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<artifactId>ebean</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>ebean</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.ebean</groupId>
|
|
||||||
<artifactId>ebean</artifactId>
|
|
||||||
<version>11.22.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.h2database</groupId>
|
|
||||||
<artifactId>h2</artifactId>
|
|
||||||
<version>1.4.196</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<!-- Need to fix this pluginManagement -->
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>io.ebean</groupId>
|
|
||||||
<artifactId>ebean-maven-plugin</artifactId>
|
|
||||||
<version>11.11.2</version>
|
|
||||||
<executions>
|
|
||||||
<!-- enhance main classes -->
|
|
||||||
<execution>
|
|
||||||
<id>main</id>
|
|
||||||
<phase>process-classes</phase>
|
|
||||||
<configuration>
|
|
||||||
<transformArgs>debug=1</transformArgs>
|
|
||||||
</configuration>
|
|
||||||
<goals>
|
|
||||||
<goal>enhance</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
@ -249,6 +249,18 @@
|
|||||||
<version>${awaitility.version}</version>
|
<version>${awaitility.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.ebean</groupId>
|
||||||
|
<artifactId>ebean</artifactId>
|
||||||
|
<version>11.22.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@ -332,27 +344,7 @@
|
|||||||
<!-- /Reladomo -->
|
<!-- /Reladomo -->
|
||||||
|
|
||||||
<!-- JDO Plugin -->
|
<!-- JDO Plugin -->
|
||||||
<plugin>
|
|
||||||
<groupId>org.datanucleus</groupId>
|
|
||||||
<artifactId>datanucleus-maven-plugin</artifactId>
|
|
||||||
<version>${datanucleus-maven-plugin.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<api>JDO</api>
|
|
||||||
<props>${basedir}/datanucleus.properties</props>
|
|
||||||
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
|
|
||||||
<verbose>true</verbose>
|
|
||||||
<fork>false</fork>
|
|
||||||
<!-- Solve windows line too long error -->
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>process-classes</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>enhance</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@ -380,6 +372,28 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.ebean</groupId>
|
||||||
|
<artifactId>ebean-maven-plugin</artifactId>
|
||||||
|
<version>11.11.2</version>
|
||||||
|
<executions>
|
||||||
|
<!-- enhance main classes -->
|
||||||
|
<execution>
|
||||||
|
<id>main</id>
|
||||||
|
<phase>process-classes</phase>
|
||||||
|
<configuration>
|
||||||
|
<transformArgs>debug=1</transformArgs>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>enhance</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -1,59 +1,59 @@
|
|||||||
package com.baeldung.ebean.model;
|
package com.baeldung.ebean.model;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.MappedSuperclass;
|
import javax.persistence.MappedSuperclass;
|
||||||
import javax.persistence.Version;
|
import javax.persistence.Version;
|
||||||
|
|
||||||
import io.ebean.annotation.WhenCreated;
|
import io.ebean.annotation.WhenCreated;
|
||||||
import io.ebean.annotation.WhenModified;
|
import io.ebean.annotation.WhenModified;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class BaseModel {
|
public abstract class BaseModel {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
protected long id;
|
protected long id;
|
||||||
|
|
||||||
@Version
|
@Version
|
||||||
protected long version;
|
protected long version;
|
||||||
|
|
||||||
@WhenCreated
|
@WhenCreated
|
||||||
protected Instant createdOn;
|
protected Instant createdOn;
|
||||||
|
|
||||||
@WhenModified
|
@WhenModified
|
||||||
protected Instant modifiedOn;
|
protected Instant modifiedOn;
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(long id) {
|
public void setId(long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getCreatedOn() {
|
public Instant getCreatedOn() {
|
||||||
return createdOn;
|
return createdOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedOn(Instant createdOn) {
|
public void setCreatedOn(Instant createdOn) {
|
||||||
this.createdOn = createdOn;
|
this.createdOn = createdOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getModifiedOn() {
|
public Instant getModifiedOn() {
|
||||||
return modifiedOn;
|
return modifiedOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModifiedOn(Instant modifiedOn) {
|
public void setModifiedOn(Instant modifiedOn) {
|
||||||
this.modifiedOn = modifiedOn;
|
this.modifiedOn = modifiedOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getVersion() {
|
public long getVersion() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVersion(long version) {
|
public void setVersion(long version) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,42 +1,42 @@
|
|||||||
package com.baeldung.ebean.model;
|
package com.baeldung.ebean.model;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Customer extends BaseModel {
|
public class Customer extends BaseModel {
|
||||||
|
|
||||||
public Customer(String name, Address address) {
|
public Customer(String name, Address address) {
|
||||||
super();
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@OneToOne(cascade = CascadeType.ALL)
|
@OneToOne(cascade = CascadeType.ALL)
|
||||||
Address address;
|
Address address;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Address getAddress() {
|
public Address getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddress(Address address) {
|
public void setAddress(Address address) {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Customer [id=" + id + ", name=" + name + ", address=" + address + "]";
|
return "Customer [id=" + id + ", name=" + name + ", address=" + address + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user