use simple @GeneratedValue and some code cleanup

This commit is contained in:
Michael Hoennig 2022-10-27 09:42:18 +02:00
parent 09c19649e4
commit 1d0d2372ea
12 changed files with 38 additions and 53 deletions

View File

@ -86,7 +86,7 @@ public class RestResponseEntityExceptionHandler
Optional.ofNullable(response.getBody()).map(Object::toString).orElse(firstMessageLine(exc))); Optional.ofNullable(response.getBody()).map(Object::toString).orElse(firstMessageLine(exc)));
} }
//@ExceptionHandler({ MethodArgumentNotValidException.class }) @Override
@SuppressWarnings("unchecked,rawtypes") @SuppressWarnings("unchecked,rawtypes")
protected ResponseEntity handleMethodArgumentNotValid( protected ResponseEntity handleMethodArgumentNotValid(
MethodArgumentNotValidException exc, MethodArgumentNotValidException exc,

View File

@ -32,8 +32,7 @@ public class HsOfficeBankAccountEntity implements Stringifyable {
.withProp(Fields.bic, HsOfficeBankAccountEntity::getBic); .withProp(Fields.bic, HsOfficeBankAccountEntity::getBic);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
private String holder; private String holder;

View File

@ -2,11 +2,10 @@ package net.hostsharing.hsadminng.hs.office.coopshares;
import com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType; import com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType;
import lombok.*; import lombok.*;
import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable;
import net.hostsharing.hsadminng.errors.DisplayName; import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity;
import org.hibernate.annotations.GenericGenerator; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDef;
@ -40,8 +39,7 @@ public class HsOfficeCoopSharesTransactionEntity implements Stringifyable {
.quotedValues(false); .quotedValues(false);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
@ManyToOne @ManyToOne

View File

@ -2,11 +2,11 @@ package net.hostsharing.hsadminng.hs.office.debitor;
import lombok.*; import lombok.*;
import net.hostsharing.hsadminng.errors.DisplayName; import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable;
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*; import javax.persistence.*;
@ -32,7 +32,7 @@ public class HsOfficeDebitorEntity implements Stringifyable {
.quotedValues(false); .quotedValues(false);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator") @GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;

View File

@ -9,11 +9,12 @@ import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity;
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
import net.hostsharing.hsadminng.stringify.Stringify; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable; import net.hostsharing.hsadminng.stringify.Stringifyable;
import org.hibernate.annotations.*; import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import javax.persistence.*; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.UUID; import java.util.UUID;
@ -48,8 +49,7 @@ public class HsOfficeMembershipEntity implements Stringifyable {
.quotedValues(false); .quotedValues(false);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
@ManyToOne @ManyToOne
@ -83,7 +83,8 @@ public class HsOfficeMembershipEntity implements Stringifyable {
public Range<LocalDate> getValidity() { public Range<LocalDate> getValidity() {
if (validity == null) { if (validity == null) {
validity = Range.infinite(LocalDate.class); validity = Range.infinite(LocalDate.class);
}; }
;
return validity; return validity;
} }

View File

@ -1,10 +1,9 @@
package net.hostsharing.hsadminng.hs.office.partner; package net.hostsharing.hsadminng.hs.office.partner;
import lombok.*; import lombok.*;
import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.stringify.Stringify; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable; import net.hostsharing.hsadminng.stringify.Stringifyable;
import net.hostsharing.hsadminng.errors.DisplayName;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDate; import java.time.LocalDate;
@ -34,8 +33,7 @@ public class HsOfficePartnerDetailsEntity implements Stringifyable {
.quotedValues(false); .quotedValues(false);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
private @Column(name = "registrationoffice") String registrationOffice; private @Column(name = "registrationoffice") String registrationOffice;

View File

@ -2,11 +2,10 @@ package net.hostsharing.hsadminng.hs.office.partner;
import lombok.*; import lombok.*;
import net.hostsharing.hsadminng.errors.DisplayName; import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import org.hibernate.annotations.GenericGenerator; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable;
import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction; import org.hibernate.annotations.NotFoundAction;
@ -32,8 +31,7 @@ public class HsOfficePartnerEntity implements Stringifyable {
.quotedValues(false); .quotedValues(false);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
@ManyToOne @ManyToOne

View File

@ -7,7 +7,6 @@ import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.stringify.Stringify; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable; import net.hostsharing.hsadminng.stringify.Stringifyable;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDef;
@ -38,8 +37,7 @@ public class HsOfficePersonEntity implements Stringifyable {
.withProp(Fields.givenName, HsOfficePersonEntity::getGivenName); .withProp(Fields.givenName, HsOfficePersonEntity::getGivenName);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
@Column(name = "persontype") @Column(name = "persontype")

View File

@ -3,10 +3,9 @@ package net.hostsharing.hsadminng.hs.office.relationship;
import com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType; import com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType;
import lombok.*; import lombok.*;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import org.hibernate.annotations.GenericGenerator; import net.hostsharing.hsadminng.stringify.Stringify;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDef;
@ -36,8 +35,7 @@ public class HsOfficeRelationshipEntity {
.withProp(Fields.contact, HsOfficeRelationshipEntity::getContact); .withProp(Fields.contact, HsOfficeRelationshipEntity::getContact);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
@ManyToOne @ManyToOne

View File

@ -4,11 +4,10 @@ import com.vladmihalcea.hibernate.type.range.PostgreSQLRangeType;
import com.vladmihalcea.hibernate.type.range.Range; import com.vladmihalcea.hibernate.type.range.Range;
import lombok.*; import lombok.*;
import net.hostsharing.hsadminng.errors.DisplayName; import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable;
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity;
import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity;
import org.hibernate.annotations.GenericGenerator; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable;
import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDef;
import javax.persistence.*; import javax.persistence.*;
@ -39,8 +38,7 @@ public class HsOfficeSepaMandateEntity implements Stringifyable {
.quotedValues(false); .quotedValues(false);
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
@ManyToOne @ManyToOne

View File

@ -4,7 +4,6 @@ import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*; import javax.persistence.*;
import java.util.UUID; import java.util.UUID;
@ -16,9 +15,9 @@ import java.util.UUID;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class TestCustomerEntity { public class TestCustomerEntity {
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
private String prefix; private String prefix;

View File

@ -5,7 +5,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import net.hostsharing.hsadminng.test.cust.TestCustomerEntity; import net.hostsharing.hsadminng.test.cust.TestCustomerEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*; import javax.persistence.*;
import java.util.UUID; import java.util.UUID;
@ -19,8 +18,7 @@ import java.util.UUID;
public class TestPackageEntity { public class TestPackageEntity {
@Id @Id
@GeneratedValue(generator = "UUID") @GeneratedValue
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
private UUID uuid; private UUID uuid;
@Version @Version