Hi all,
I would like to write a bulletin-board application with hibernate. I thought one topic will be one table, and a message in a topic a row (with an id).
I've written this entity class:
@Entity @Table(name = "TOPIC") public class Topic {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private Long id;
@Column(name = "MESSAGE") private String message;
/*constructors, getters, setters */
When I use this entity class, and the table named TOPIC doesn't exist in the database, hibernate creates it. That's OK.
But, I want hibernate to create tables for each topic that users open, and use the preceding entity class to manipulate the messages of all the topics. How should I do it?
And, anyway... What do you think about the schema? I know it's very very simple. Is there any idea how I can improve it?
Thanks in advance!
Gábor
|