Skip to content

Commit

Permalink
domain - set some columns to arbitrary length (TEXT type)
Browse files Browse the repository at this point in the history
In some cases we would need more than the default length for string
(255chars).

As indicated in a comment, this is not portable, but works with
postgresql which is the de-facto standard in geOrchestra ?
Rapidly checking, it looks like Oracle also supports it.

Tests: runtime tested.
  • Loading branch information
pmauduit committed Oct 23, 2024
1 parent 9c696dd commit d9717e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
27 changes: 4 additions & 23 deletions domain/src/main/java/org/fao/geonet/domain/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,8 @@

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.MapKeyColumn;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.*;

import org.fao.geonet.domain.converter.BooleanToYNConverter;

import org.fao.geonet.entitylistener.GroupEntityListenerManager;
Expand Down Expand Up @@ -141,7 +121,7 @@ public Group setName(String name) {
*
* @return the description.
*/
@Column(length = 255)
@Column(columnDefinition = "TEXT")
public String getDescription() {
return _description;
}
Expand Down Expand Up @@ -245,6 +225,7 @@ public boolean isReserved() {
* @return the filename of the logo or null if there is no logo associated with this group.
*/
@Nullable
@Column(columnDefinition = "TEXT")
public String getLogo() {
return logo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@

import java.util.Objects;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.*;

import org.fao.geonet.domain.Group;

Expand Down Expand Up @@ -55,6 +50,7 @@ public enum GroupSyncMode {
private String externalId;
private GroupSyncMode origin;
private String name;

private String description;
private String linkage;
private String lastUpdated;
Expand Down Expand Up @@ -108,6 +104,12 @@ public ExternalGroupLink setName(String name) {
return this;
}

/**
* Note: this is not portable, as the TEXT definition does not
* exist on all DBMS. But considering geOrchestra, we are supposed
* to rely on a PostGreSQL server.
*/
@Column(columnDefinition = "TEXT")
public String getDescription() {
return description;
}
Expand Down

0 comments on commit d9717e1

Please sign in to comment.