Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: JPA Invalid Identifier Error
PostPosted: Wed Jan 11, 2017 6:15 pm 
Newbie

Joined: Wed Jan 11, 2017 6:13 pm
Posts: 1
I have two entity class having relationship one to one. while fetching data, I am getting below error.

Note: In "EPLAN_ELEMENT_DEFINITION" table primary key is "ELEMENT_DEFINITION_ID" and in "EPLAN_INPUT_ELEMENT" table foreign key is "INPUT_ELEMENT_ID". Basically name of keys are different in both tables.

**************** ERR****************

08:50:52.536 DEBUG [http-bio-8080-exec-8][SqlExceptionHelper] could not extract ResultSet [n/a] java.sql.SQLSyntaxErrorException: ORA-00904: "ELEMENTDEF0_"."INPUTELEMENT": invalid identifier

**************** ERR****************

Source Code:-

ElementDefinition:

Code:
@Entity

@Table(name = "EPLAN_ELEMENT_DEFINITION")

@Inheritance(strategy = InheritanceType.SINGLE_TABLE)

@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)

public abstract class ElementDefinition extends au.gov.nsw.lpi.bds.eplan.elements.ElementDefinition
{
    @Id
    @Column(name = "ELEMENT_DEFINITION_ID")
    private Long id;
    @Column(name = "NAME")
    @Enumerated(EnumType.STRING)
    private ElementName name;


    @Column(name = "DESCRIPTION")
    private String description;

    public Long getId() {
        return id;
    }

    public String getDescription() {
        return description;
    }

    private InputElement inputElement;

    @OneToOne(mappedBy = "elementDefinition")
    public InputElement getInputElement() {
        return inputElement;
    }

    public void setInputElement(InputElement inputElement) {
        this.inputElement = inputElement;
    }

    @Override
    public ElementName name() {
        return getName();
    }

    public ElementName getName() {
        return name;
    }
}


Input Element:

Code:
@Entity

@Table(name = "EPLAN_INPUT_ELEMENT")

public class InputElement implements Serializable
{


    private ElementDefinition elementDefinition;

     @Id
     @OneToOne
     @JoinColumn(name="INPUT_ELEMENT_ID", referencedColumnName="ELEMENT_DEFINITION_ID")     

     public ElementDefinition getElementDefinition() {
        return elementDefinition;
     }

     public void setElementDefinition(ElementDefinition elementDefinition) {
        this.elementDefinition = elementDefinition;
     }


    public void setDefaultMandatoryInd(String defaultMandatoryInd) {
        this.defaultMandatoryInd = defaultMandatoryInd;
    }

}


Top
 Profile  
 
 Post subject: Re: JPA Invalid Identifier Error
PostPosted: Thu Jan 12, 2017 2:25 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1433
Looks like you have an INPUTELEMENT column in the database table. Can you post the table schema as well?

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.