Added cross references, cleaned the persistence config, added default

tab view for Article and order.
This commit is contained in:
sockenklaus
2020-05-29 19:41:39 +02:00
parent 80c928921e
commit 33ca1ca7f9
12 changed files with 225 additions and 200 deletions

View File

@@ -17,3 +17,7 @@ pattern=Muster
brand=Marke
condition=Zustand
size=Gr<EFBFBD><EFBFBD>e
# ???
Cards=Karten
and=und

View File

@@ -8,22 +8,15 @@
<persistence-unit name="default">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>java://comp/env/jdbc/BabydatenbankDS</non-jta-data-source>
<class>org.openxava.session.GalleryImage</class>
<class>org.openxava.web.editors.DiscussionComment</class>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="update"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL8Dialect" />
<property name="javax.persistence.create-database-schemas" value="true"/>
<property name="hibernate.default_catalog" value="admin_babydatenbank"/>
<property name="hibernate.default_catalog" value="admin_babydatenbank"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL8Dialect" />
<property name="javax.persistence.create-database-schemas" value="true"/>
<property name="hibernate.jdbc.use_streams_for_binary" value="true"/>
<property name="hibernate.connection.driver_class" value="com.mysql.cj.jdbc.Driver"/>
<property name="hibernate.connection.username" value="babydatenbank_usr" />
<property name="hibernate.connection.password" value="mJq63*n1" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/admin_babydatenbank?serverTimezone=Europe/Berlin&amp;useUnicode=true&amp;characterEncoding=UTF-8"/>
<property name="hibernate.connection.charSet" value="UTF-8" />
<property name="hibernate.connection.characterEncoding" value="UTF-8" />
<property name="hibernate.connection.useUnicode" value="true" />
<property name="javax.persistence.schema-generation.database.action" value="update"/>
</properties>
</persistence-unit>

View File

@@ -45,12 +45,12 @@ smtpStartTLSEnable=false
# This affects only if Java logging is used (usually in Tomcat and WebSphere).
# It does not affect log4j configuration (usually in JBoss or if you use log4j in your app).
# Default value is INFO
javaLoggingLevel=FINE
javaLoggingLevel=WARNING
# LOGGING LEVEL FOR HIBERNATE ENGINE
# Possibles values are: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL, OFF
# Default value is INFO
#hibernateJavaLoggingLevel=FINEST
hibernateJavaLoggingLevel=WARNING
# help
#helpAvailable=false

View File

@@ -18,11 +18,12 @@ import java.time.*;
"#buyDate, sellDate];" +
"remarks"
)
@Tab(properties="name, photo, category.description, brand.description, pattern.description, size.description, condition.description, remarks", defaultOrder="${name} asc")
public class Article {
@Id @Hidden @GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
@Id @Hidden @GeneratedValue(generator="system-uuid2") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid2", strategy = "uuid2")
@Column(length=36)
private String oid;
@Column(length=32)
@@ -42,7 +43,7 @@ public class Article {
@DescriptionsList
private Pattern pattern;
@ManyToOne(optional=true, fetch = FetchType.EAGER)
@ManyToOne
@NoModify
@DescriptionsList
private Category category;

View File

@@ -10,16 +10,16 @@ public class Brand {
@Id
@Hidden
@GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
@GeneratedValue(generator="system-uuid2") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid2", strategy = "uuid2")
@Column(length=36)
private String oid;
@Column(length=20)
private String description;
@OneToMany(mappedBy="brand", fetch = FetchType.EAGER)
@ListProperties("name, category.description")
@OneToMany(mappedBy="brand")
@ListProperties("name, category.description, pattern.description, size.description, condition.description")
private Collection<Article> articles;
public String getOid() {

View File

@@ -1,7 +1,7 @@
package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import java.util.*;
import org.hibernate.annotations.GenericGenerator;
import org.openxava.annotations.*;
@@ -9,14 +9,18 @@ import org.openxava.annotations.*;
public class Category {
@Id
@Hidden
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
@GeneratedValue(generator="system-uuid2")
@GenericGenerator(name="system-uuid2", strategy = "uuid2")
@Column(length=36)
private String oid;
@Column(length=20)
private String description;
@OneToMany(mappedBy="category")
@ListProperties("name, brand.description, pattern.description, size.description, condition.description")
private Collection<Article> articles;
public String getDescription() {
return description;
}
@@ -33,5 +37,14 @@ public class Category {
this.oid = oid;
}
public Collection<Article> getArticles() {
return articles;
}
public void setArticles(Collection<Article> articles) {
this.articles = articles;
}
}

View File

@@ -8,9 +8,9 @@ import org.openxava.annotations.*;
public class Condition {
@Id
@Hidden
@GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
@GeneratedValue(generator="system-uuid2")
@GenericGenerator(name="system-uuid2", strategy = "uuid2")
@Column(length=36)
private String oid;
@Column(length=4)

View File

@@ -3,20 +3,25 @@ package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import org.openxava.annotations.*;
import java.util.*;
@Entity
public class Pattern {
@Id
@Hidden
@GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
@GeneratedValue(generator="system-uuid2") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid2", strategy = "uuid2")
@Column(length=36)
private String oid;
@Column(length=20)
private String description;
@OneToMany(mappedBy="pattern")
@ListProperties("name, brand.description, category.description, size.description, condition.description")
private Collection<Article> articles;
public String getDescription() {
return description;
}
@@ -33,5 +38,14 @@ public class Pattern {
this.oid = oid;
}
public Collection<Article> getArticles() {
return articles;
}
public void setArticles(Collection<Article> articles) {
this.articles = articles;
}
}

View File

@@ -9,9 +9,9 @@ public class Size {
@Id
@Hidden
@GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
@GeneratedValue(generator="system-uuid2") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid2", strategy = "uuid2")
@Column(length=36)
private String oid;
@Column(length=20)

View File

@@ -29,7 +29,7 @@
<Resource name="jdbc/BabydatenbankDS" auth="Container" type="javax.sql.DataSource"
maxTotal="20" maxIdle="5" maxWaitMillis="10000"
username="babydatenbank_usr" password="mJq63*n1" driverClassName="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://localhost:3306/admin_babydatenbank?serverTimezone=Europe/Berlin&amp;useUnicode=true&amp;characterEncoding=UTF-8"/>
url="jdbc:mysql://localhost:3306/?serverTimezone=Europe/Berlin&amp;useUnicode=true&amp;characterEncoding=UTF-8"/>
<!-- PostgreSQL
<Resource name="jdbc/BabydatenbankDS" auth="Container" type="javax.sql.DataSource"

Binary file not shown.

Binary file not shown.