views:

39

answers:

2

Caused by:

org.hibernate.MappingException: Could not determine type for: controler.Role, for columns: [org.hibernate.mapping.Column(ROLE)]

Can you please help me on this?

this is my mapping class

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt;
<hibernate-mapping>
  <class name="controler.Role" table="ROLE">
      <id name="roleId" column="ROLEID">
          <generator class="increment"/>
      </id>
      <property name="title" column="TITLE"/>
  </class>
</hibernate-mapping>

the Role is a pojo class and i have the relevant table named Role in the JavaDB. The role table has attributes roleid(char) and roletitle(varchar)

+3  A: 

Caused by: org.hibernate.MappingException: Could not determine type for: controler.Role, for columns: [org.hibernate.mapping.Column(ROLE)]

My initial assumption was wrong. But now that you mentioned JavaDB, I suspect that ROLE is actually a reserved keyword. Try to enclose the table name in backticks in the mapping document:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt;
<hibernate-mapping>
  <class name="controler.Role" table="`ROLE`">
      <id name="roleId" column="ROLEID">
          <generator class="increment"/>
      </id>
      <property name="title" column="TITLE"/>
  </class>
</hibernate-mapping>

References

Pascal Thivent
The Role is actually a table in the Java DB. i have a pojo class named "Role" and the Role table has "roleid"(char) and "roletitle"(varchar).
hasitha
This is my mapping class <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping> <class name="controler.Role" table="ROLE"> <id name="roleId" column="ROLEID"> <generator class="increment"/> </id> <property name="title" column="TITLE"/> </class></hibernate-mapping>
hasitha
@hasitha Edit your question (there is an edit link at the bottom) to post your POJOs and mappings.
Pascal Thivent
@hasitha: If you indent your XML with Ctrl-K, it'll show up in the text
Ruben Bartelink
i have updated my question Ruben, can please reffere to it ....thanx a lot
hasitha
@Pascal Thivent Unfortunately I could not see your responses about Scrum / Agile. I hope I have some spare time this week. Anyway, UP
Arthur Ronald F D Garcia
@Arthur Thanks. Regarding my Scrum/Agile answers, no problem, I'm not going to remove them anyway ;)
Pascal Thivent
A: 

Is the fully-qualified name of the Java class actually controler.Role? What does the source code of the Role class look like? Is it in a package named controler?

Perhaps the name is simply misspelt.

matt b