Hello!
I'm converting a kind of complicated application to use hibernate+annotations for persistence. I'm stuck with the old classnames like "File" which creates some problems for me.
I can annotate it like this, avoiding reserved words conflicts :
Code:
@Entity
@Table(name = "`File`")
public class File ...
and it works nicely until I try to make a manytomany relation like this :
Code:
@ManyToMany(targetEntity=FileFolder.class )
@JoinTable(
name="File_FileFolder",
joinColumns={@JoinColumn(name="File_id")},
inverseJoinColumns={@JoinColumn(name="FileFolder_id")}
)
private List virtualFolders;
What happens is I get an exception when creating my session factory :
Code:
org.hibernate.MappingException: Unable to find physical table: File
at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:473)
at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:520)
at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:866)
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:527)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:468)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1049)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1205)
It seems the relation somehow makes Hibernate forget that my File-class is mapped to `File`...
Any suggestions?
I'm using Hibernate version: 3.2.0cr3 + annotations 3.2.0cr1