java - Hibernate will not make indexes when creating tables from annotations -


I am using hibernate with hbm2ddl.auto = update so that it automatically Oracle Tables for me (I have no intention of learning Oracle's SQL.)

So far, very good, so far I'm trying to get it to create an index. As far as I can tell, I have made my comments correctly:

  package data; Import javax.preistence *; Import org.hibernate.annotations.Index; @ Entity @Table (name = "log_entries") @ org.hibernate.annotations.Table (Apply = "log_entries", index = {@ index (name = "idx", columnNames = {"job", "version", "Schedule", "DTTMran", "PID"})}) Public Class Logentary {@Id @GeneratedValue Long ID; String job; String version; String schedule; String dttmrun; Int pid; String command; Int duration; // getters and setters ...}  

When I drop the table and restart my app, it creates the table, but does not any index index?

I tested your code on the derby and that's when I got the schema Update schemaexport :

  create a drop table log_entry table log_entries (id bilton null, command behavior (255), dttmran varna (255) Create index idx on log_entries (job, period, integer faucet, job varchar (255), pid integer not blank, schedule varchar (255), version varchar (255), primary key (id) Nskrn, schedule, DttmRun, pid)  

can not be tried yet though Oracle works as expected.

Hibernate with trial with EM 3.4.0. GA, Hibernate Annotation 3.4.0.ga, Hibernate Core 3.3.0.SP1

Update: I realized that SchemaXport , SchemaUpdate did not go and confirm that when it is running SchemaUpdate with versions of the above libraries, therefore, while has been rejected as a victim of while is rejected Is marked as definitively, while open (!!), my quick test did not work as expected I later got a deeper Speed ​​do but now I am very skeptical (especially).


Comments