DDL in hibernate

how to do DDL Operation in hibernatelike creating table,creating sequence,droping table,how to get sequence value from table like select next.val from dual;
[184 byte] By [Meenaxia] at [2007-11-27 8:16:00]
# 1
> how to do DDL Operation in hibernate> like creating table,creating sequence,droping table,Don't.> how to get sequence value from table > like select next.val from dual;That's not a DDL operation.D.
dcmintera at 2007-7-12 20:00:51 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Please disregard dcminter's response. He is incapable of providing useful responses, unfortunately.

I have ran into a similar problem, and Hibernate provides build in functionality to execute DDL commands.

An option could be:

Configuration config = new Configuration().configure();

SchemaExport sch = new SchemaExport(config);

sch.create(true, true);

SessionFactory sessionFactory = config.buildSessionFactory();

======

The above will run the DDL generation process via code ... another may be ...

Session session = HibernateUtil.getSessionFactory().getCurrentSession();

session.beginTransaction();

session.createQuery("delete popolamento.Spectra").executeUpdate();

session.getTransaction().commit();

HibernateUtil.getSessionFactory().close();

=====

The above will let you run your own DDL queries. Unfortunately, this is one of the little known weakness of Hibernate .. DDL queries.

Shannaraa at 2007-7-12 20:00:51 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
> Please disregard dcminter's response. He is incapable> of providing useful responses, unfortunately.Right. Because your one-month-late tantrum will definitely be more useful.DDL from Hibernate is a bad idea. If you don't understand why, that's your problem.
dcmintera at 2007-7-12 20:00:51 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...