Galera é o seguinte, não estou conseguindo fazer o seguinte mapeamento corretamente.
Tenho uma classe chamada Pessoa, essa classe possui um relacionamento com TipoPessoa. Tenho outra classe chamada PessoaFisica.
PessoaFisica extende de TipoPessoa.
Ocorre o Seguinte erro:
14:22:40 INFO [EntityBinder] Bind entity br.com.sgfcasamento.modelo.PessoaFisica on table PessoaFisica
Exception in thread "main" java.lang.ClassCastException: org.hibernate.mapping.JoinedSubclass cannot be cast to org.hibernate.mapping.RootClass
at org.hibernate.cfg.annotations.PropertyBinder.bind(PropertyBinder.java:209)
at org.hibernate.cfg.annotations.PropertyBinder.makePropertyValueAndBind(PropertyBinder.java:200)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1988)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:769)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at br.com.softwaremadeinbrazil.sgfcasamento.hibernate.GeradorDeBanco.main(GeradorDeBanco.java:12)
Dei uma lida sobre as anotações: @Inheritance(strategy = InheritanceType.JOINED),@PrimaryKeyJoinColumn. Porem não
entendi muito bem. Se alguem poder me dar uma explicação ficarei muito grato.