Hi,
I'm trying to create dynamic models and I can't get indexes to work. So far I've tested with PostgreSQL and SQLServer.
I'm configuring like this:
Code:
Configuration cfg = new Configuration()
.addFile(new File("Person2.hbm.xml"))
.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect")
.setProperty("hibernate.connection.url", "jdbc:postgresql://localhost/hibernate")
.setProperty("hibernate.connection.driver_class", "org.postgresql.Driver")
.setProperty("hibernate.connection.username", "test")
.setProperty("hibernate.connection.password", "test")
.setProperty("hibernate.order_updates", "true")
.setProperty("hibernate.hbm2ddl.auto", "update")
.setProperty("hibernate.show_sql", "false");
SessionFactory sessions = cfg.buildSessionFactory();
Session session = sessions.openSession();
My Person2.hbm.xml is like:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class entity-name="Person2" table="PERSON2">
<id name="id" column="P_ID" type="long">
<generator class="native"/>
</id>
<property name="age" type="integer" column="P_AGE" index="P_AGE_INDEX"/>
<property name="firstname" type="string" column="P_FIRSTNAME"/>
<property name="lastname" type="string" column="P_LASTNAME"/>
</class>
</hibernate-mapping>
The I open the graphic PostgreSQL tool and there's no index created besides the one on the PK.
What do I have to do to get indexes working?
Thanks in advance,
Rui