I'm using Hibernate 3.1rc1 and Hibernate Annotations 3.1beta6. I have an Address class that is annotated like so:
@org.hibernate.annotations.Entity(
selectBeforeUpdate = true,
dynamicInsert = true,
dynamicUpdate = true,
optimisticLock = OptimisticLockType.ALL)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@BatchSize(size = 5)
@Table(name = "addresses")
@javax.persistence.Entity
public class Address implements Serializable {
private static final long serialVersionUID = 123;
...
}
I have some code that tries to save an address:
Transaction tx = session.beginTransaction();
Address address = new Address();
address.setCity(city);
address.setStreet(street);
session.persist(address);
tx.commit();
The SQL that is getting generated is:
insert into Address (city, lat, street, long, id) values (?, ?, ?, ?, ?)
The problem is that my table name is "addresses", but Hibernate seems to be using the name of the class instead. The spec says that the classname is the default table name unless the @Table(name) attribute is specified.
So, is there some reason that Hibernate is ignoring that annotation and trying to use the class name instead?
-M@
|