I'm newbee in hibernate. and i'm korean and i cann't speak english well.
please understand me.
I have a problem using collcetion.
Exception is "Could not determine type for: String, for columns: [org.hibernate.mapping.Column(tag)]
Now show my sql script and *.hbm.xml and java file.
i make two table, studing collection Set type.
this is simple article tag example.
create table article(
id int not null auto_increment,
title varchar(20),
primary key (id)
);
create table article_tag(
article_id int not null,
tag varchar(50),
foreign key (article_id) references article(id)
);
and show hbm.xml
<hibernate-mapping package="model">
<class name="Article" table="ARTICLE">
<id name="id" column="ID">
<generator class="identity" />
</id>
<property name="title" />
<set name="tags" table="ARTICLE_TAG">
<key column="ARTICLE_ID" />
<element type="String" column="tag" />
</set>
</class>
</hibernate-mapping>
and show log bean class.
public class Article {
private int id;
private String title;
private Set<String> tags = new HashSet<String>();
public Article() {}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Set<String> getTags() {
return tags;
}
public void setTags(Set<String> tags) {
this.tags = tags;
}
}
and if i test that code.
hibernate make exception this.
org.hibernate.MappingException: Could not determine type for: String, for columns: [org.hibernate.mapping.Column(tag)]
pleast help me.
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
mysql
The generated SQL (show_sql=true):
yes
Debug level Hibernate log excerpt:
yes
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html