0

I'm using JPA/Hibernate 4.3.7 and Oracle 12c

When I try to persist one of the entities I get the following error.

The base entity (Profile) is has the following annotation

@Inheritance(strategy = InheritanceType.JOINED)


 Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement
    Caused by: org.hibernate.exception.SQLGrammarException: could not execute statement
    Caused by: java.sql.SQLSyntaxErrorException: ORA-02000: missing ) keyword

But I don't get this issue when I'm using hsqldb.

SQL tracing via Pastebin here http://pastebin.com/rXrqzTQ0

@Entity
@DiscriminatorValue("CNT")
@Table(name = "containers")
public class Container extends Profile implements Serializable, IEntity {

    @ManyToOne(optional = false)
    @JoinColumn(name = "HIERARCHY_TYPES_ID", nullable = true, updatable = false)
    private HierarchyType hierarchyType;

    @ManyToOne(optional = false)
    @JoinColumn(name = "HIERARCHY_SUB_TYPES_ID", nullable = true, updatable = false)
    private HierarchySubType hierarchySubType;

    @ManyToOne(optional = false)
    @JoinColumn(name = "SEGMENT_ID", nullable = true, updatable = false)
    private Segment segment;

    @ManyToOne(optional = false)
    @JoinColumn(name = "SUB_SEGMENT_ID", nullable = true, updatable = false)
    private Subsegment subsegment;

    @ManyToOne(optional = false)
    @JoinColumn(name = "USERS_ID_HIERARCHY_OWNER", nullable = true, updatable = false)
    private User user;

    @Column(name = "CONTAINER_NAME", nullable = true, length = 200)
    private String containerName;

    public Container(String containerName) {
        this.containerName = containerName;
    }

    public Container() {
    }

    public HierarchyType getHierarchyType() {
        return hierarchyType;
    }

    public void setHierarchyType(HierarchyType hierarchyType) {
        this.hierarchyType = hierarchyType;
    }

    public HierarchySubType getHierarchySubType() {
        return hierarchySubType;
    }

    public void setHierarchySubType(HierarchySubType hierarchySubType) {
        this.hierarchySubType = hierarchySubType;
    }

    public Segment getSegment() {
        return segment;
    }

    public void setSegment(Segment segment) {
        this.segment = segment;
    }

    public Subsegment getSubsegment() {
        return subsegment;
    }

    public void setSubsegment(Subsegment subsegment) {
        this.subsegment = subsegment;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getContainerName() {
        return containerName;
    }

    public void setContainerName(String containerName) {
        this.containerName = containerName;
    }
}
Siya Sosibo
  • 338
  • 1
  • 10
  • 23

1 Answers1

0

Seems "CONTAINERS" is a reserved word since Oracle 12c.

I have to rename my table to "CONTAINER" then I was able to persist.

See https://stackoverflow.com/a/35487848/1458556

Community
  • 1
  • 1
Siya Sosibo
  • 338
  • 1
  • 10
  • 23