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

@@ -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,37 +1,50 @@
package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import org.openxava.annotations.*;
@Entity
public class Category {
@Id
@Hidden
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
private String oid;
@Column(length=20)
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
}
package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import java.util.*;
import org.hibernate.annotations.GenericGenerator;
import org.openxava.annotations.*;
@Entity
public class Category {
@Id
@Hidden
@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;
}
public void setDescription(String description) {
this.description = description;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
public Collection<Article> getArticles() {
return articles;
}
public void setArticles(Collection<Article> articles) {
this.articles = articles;
}
}

View File

@@ -1,46 +1,46 @@
package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import org.openxava.annotations.*;
@Entity
public class Condition {
@Id
@Hidden
@GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
private String oid;
@Column(length=4)
private int number;
@Column(length=32)
private String description;
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getNumber() {
return this.number;
}
public void setNumber(int number) {
this.number = number;
}
}
package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import org.openxava.annotations.*;
@Entity
public class Condition {
@Id
@Hidden
@GeneratedValue(generator="system-uuid2")
@GenericGenerator(name="system-uuid2", strategy = "uuid2")
@Column(length=36)
private String oid;
@Column(length=4)
private int number;
@Column(length=32)
private String description;
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getNumber() {
return this.number;
}
public void setNumber(int number) {
this.number = number;
}
}

View File

@@ -1,37 +1,51 @@
package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import org.openxava.annotations.*;
@Entity
public class Pattern {
@Id
@Hidden
@GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
private String oid;
@Column(length=20)
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
}
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-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;
}
public void setDescription(String description) {
this.description = description;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
public Collection<Article> getArticles() {
return articles;
}
public void setArticles(Collection<Article> articles) {
this.articles = articles;
}
}

View File

@@ -1,37 +1,37 @@
package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import org.openxava.annotations.*;
import org.hibernate.annotations.GenericGenerator;
@Entity
public class Size {
@Id
@Hidden
@GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32)
private String oid;
@Column(length=20)
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
}
package com.yourcompany.babydatenbank.model;
import javax.persistence.*;
import org.openxava.annotations.*;
import org.hibernate.annotations.GenericGenerator;
@Entity
public class Size {
@Id
@Hidden
@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;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
}