I' m using the Hibernate 3.2.4 GA console and I can't see where it can work at all with my annotated entity classes. The console always wants a hibernate.hbm.xml file and there doesn't seem to be a way to add AnnotationConfiguration information there - or I can't find an example of just WHERE one would put their annotation ifnormation. I tried the old-school reverse engineered building of the .hbm.xml descriptors for each of my 100 classes, but that was a failure as well (50% of the classes could not be found, even though they ALL reside in the SAME classpath - but that's a whole different issue).
Please show me an example, or a recent web link, or a tutorial that spells out how to operate the Hibernate Console with annotated POJO classes.
In summary, how do I take something like this (having a composite-id):
Code:
...
// Generated Apr 24, 2011 2:31:22 PM by Hibernate Tools 3.2.4.GA
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* Testscratch generated by hbm2java
*/
@Entity
@Table(name = "testscratch", catalog = "database")
public class Testscratch implements java.io.Serializable {
private TestscratchId id;
public Testscratch() {
}
public Testscratch(TestscratchId id) {
this.id = id;
}
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "name", column = @Column(name = "name", nullable = false, length = 100)),
@AttributeOverride(name = "mobile", column = @Column(name = "mobile", nullable = false, length = 100)),
@AttributeOverride(name = "encname", column = @Column(name = "encname", nullable = false, length = 100)),
@AttributeOverride(name = "encmobile", column = @Column(name = "encmobile", nullable = false, length = 100)) })
public TestscratchId getId() {
return this.id;
}
// TestscratchId is just a composite-id POJO
public void setId(TestscratchId id) {
this.id = id;
}
}
And configure it under the Hibernate Console to eventually run the HQL Editor on it?