i trying run hibernate configuration eclipse , create db structure out of it. on running configuration getting following exception:
java.sql.sqlexception: ora-00942: table or view not exist java.sql.sqlexception: ora-00904: : invalid identifier errors.
i used annotations create hbm/pojo. below code. im not sure if im missing something. help?
configuration: eclipse kepler sr2 hibernate core 4+ oracle 10g jdk 8 eclipse
import javax.persistence.cascadetype; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.jointable; import javax.persistence.manytomany; import javax.persistence.joincolumn; import javax.persistence.onetomany; import javax.persistence.table; @entity public class rulequestion { //attributes @id @generatedvalue(strategy =generationtype.auto) private long id; //question name on jsp private string jspquestion; //level of question in rule data model private int level; //if question has child questions associated private boolean haschildren; //is multiselect private boolean ismultiselect; //possible answers question /*@onetomany(cascade = cascadetype.all, mappedby = "question") private list<ruleanswer> possibleanswers =new arraylist<ruleanswer>(0); *///answer question private string answer; //defeault answer private string defaultanswer; /*//associated children questions private list<rulequestion> associatedquestions;*/ //visibility private string visibility; public rulequestion() { } public long getid() { return id; } public void setid(long id) { this.id = id; } public string getjspquestion() { return jspquestion; } public void setjspquestion(string jspquestion) { this.jspquestion = jspquestion; } public int getlevel() { return level; } public void setlevel(int level) { this.level = level; } public boolean ishaschildren() { return haschildren; } public void sethaschildren(boolean haschildren) { this.haschildren = haschildren; } public boolean ismultiselect() { return ismultiselect; } public void setmultiselect(boolean ismultiselect) { this.ismultiselect = ismultiselect; } public string getanswer() { return answer; } public void setanswer(string answer) { this.answer = answer; } public string getdefaultanswer() { return defaultanswer; } public void setdefaultanswer(string defaultanswer) { this.defaultanswer = defaultanswer; } public string getvisibility() { return visibility; } public void setvisibility(string visibility) { this.visibility = visibility; }
}
add below line after @entity.
@table(name="rulequestion")
the @table annotation allows specify details of table used persist entity in database.
the @table annotation provides 4 attributes, allowing override name of table, catalogue, , schema, , enforce unique constraints on columns in table. using table name employee.
also add
@id @generatedvalue @column(name = "id") private integer id;
i have class generate table
@entity @table(name = "transaction") public class transaction { @id @generatedvalue @column(name = "id") private integer id; @column(name="ocpp_start_tag_id",nullable=false) private string ocppstarttagid; }
Comments
Post a Comment