Adding more cross references

This commit is contained in:
Socrates
2020-05-29 15:22:50 +02:00
parent def64d3380
commit 80c928921e
3 changed files with 22 additions and 9 deletions

View File

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

View File

@@ -20,9 +20,7 @@ import java.time.*;
) )
public class Article { public class Article {
@Id @Id @Hidden @GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@Hidden
@GeneratedValue(generator="system-uuid") // Universally Unique Identifier (1)
@GenericGenerator(name="system-uuid", strategy = "uuid") @GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(length=32) @Column(length=32)
private String oid; private String oid;
@@ -34,27 +32,27 @@ public class Article {
@Column(length=83886080) @Column(length=83886080)
private byte[] photo; private byte[] photo;
@ManyToOne(fetch=FetchType.LAZY, optional=true) @ManyToOne
@NoModify @NoModify
@DescriptionsList @DescriptionsList
private Size size; private Size size;
@ManyToOne(fetch=FetchType.LAZY, optional=true) @ManyToOne
@NoModify @NoModify
@DescriptionsList @DescriptionsList
private Pattern pattern; private Pattern pattern;
@ManyToOne(fetch=FetchType.LAZY, optional=true) @ManyToOne(optional=true, fetch = FetchType.EAGER)
@NoModify @NoModify
@DescriptionsList @DescriptionsList
private Category category; private Category category;
@ManyToOne(fetch=FetchType.LAZY, optional=true) @ManyToOne
@NoModify @NoModify
@DescriptionsList @DescriptionsList
private Brand brand; private Brand brand;
@ManyToOne(fetch=FetchType.LAZY, optional=true) @ManyToOne
@NoCreate @NoCreate
@NoModify @NoModify
@DescriptionsList(order="${number} ASC") @DescriptionsList(order="${number} ASC")

View File

@@ -3,6 +3,7 @@ package com.yourcompany.babydatenbank.model;
import javax.persistence.*; import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.openxava.annotations.*; import org.openxava.annotations.*;
import java.util.*;
@Entity @Entity
public class Brand { public class Brand {
@@ -16,6 +17,10 @@ public class Brand {
@Column(length=20) @Column(length=20)
private String description; private String description;
@OneToMany(mappedBy="brand", fetch = FetchType.EAGER)
@ListProperties("name, category.description")
private Collection<Article> articles;
public String getOid() { public String getOid() {
return oid; return oid;
@@ -32,5 +37,15 @@ public class Brand {
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
public Collection<Article> getArticles() {
return articles;
}
public void setArticles(Collection<Article> articles) {
this.articles = articles;
}
} }