Hibernate doesn't really support dynamic table creation. You can use hbm2ddl to generate DDL from mappings (or vice versa), but this is at SessionFactory creation time, not normal runtime. You can run native SQL to do your table creation but using that table at runtime is going to be fairly difficult to do. I think you could do it by performing your DDL via native SQL, running hmb2ddl to generate mapping files, compiling these dynamically then reconfiguring your SessionFactory with them. Sounds like a difficult (and dangerous - any user generated DDL is a security hole) thing to do.
I think you understood it in the wrong way! What I mean is, when i create a table object with the name student, it should create new Database Table with the name Student and the Database Columns as defined in the columns List.
So you are not trying to create a table in a database? When you say "it should create a new database table with the name student..." etc. do you mean you want to add a new row to an existing table called Table and two Rows in a table called Columns?
Yes, I have read again your previous post, and I have come to know that it is very defficult create table dynamically.
But if I wirte native SQL code then if in future If client want to change the DB form MySQL to some other Database then it will create problems. Thanks for all your replies.
So instead dynamically create your mapping file for the new entity and run hbm2ddl to generate the ddl (since this will give you database agnostic SQL). You'll still need to ditch your existing SessionFactory and reconfigure a new one to use the new table. Still seems like an awkward requirement though - how is anyone going to use this dynamically created table? Why does it need to be a seperate entity?