Hi All,
I am adding new columns to my entity with Hibernate API:
Code:
<hibernate-mapping>
<class entity-name="Patient">
<id name="id"
type="long"
column="ID">
<generator class="native"/>
</id>
</class>
</hibernate-mapping>
Looking for the manuals/samples gave me something like this:
Code:
Property property = new Property();
property.setName("test");
property.setNodeName(property.getName());
PersistentClass persistentClass = onfiguration.getClassMapping("Patient");
SimpleValue value = new SimpleValue(persistentClass.getTable());
value.setTypeName("string");
Column column = new Column("TABLE_COLUMN");
persistentClass.getTable().addColumn(column);
value.addColumn(column);
property.setValue(value);
persistentClass.addProperty(property);
That works fine, but now I am trying to add Index :(
I've tried something like this:
Code:
Index index = persistentClass.getTable().getOrCreateIndex("MY_INDEX");
index.addColumn(column);
or this:
Code:
Index index = new Index();
index.setName("MY_INDEX");
index.addColumn(column);
persistentClass.getTable().addIndex(index);
There are no error messages, but it doesn't create the Index in the table :'(
Could someone help me a bit?