java - Polymorphic association jpa2 hibernate -


i think im doing wrong cant working @any annotation on hibernate 4.2.2 jpa2 1.0.1

the class works ok, cant join.

my code this:

@entity(name = "conta") public class conta { @id @generatedvalue(strategy = generationtype.auto) private int id; @column(name = "empresa_id") private int empresaid; private string descricao;  @any(metacolumn = @column(name = "tipo"), fetch = fetchtype.eager) @anymetadef(idtype = "int", metatype = "string", metavalues = {         @metavalue(value = "banco", targetentity = banco.class),         @metavalue(value = "cielo", targetentity = cielo.class) }) @joincolumn(name = "financeira_id") private financeira financeira; //getters , setters } 

financeira interface, banco.class , cielo.class implements conta well. when try fetch db can records, join doesnt happen.

my code inspection on intellij idea says private financeira financeira "'basic' attribute type should not 'financeira'". know or think know message says jpa dont have metamodel @any annotation, hibernate does, so, should work right?

update

got problem solved using hibernate native xml configuration. can persist objects got problem. cant fetch association, im using factory fetch de association on @postload event, thats not right way.

above xml code.

        <any id-type="java.lang.integer" meta-type="string" name="tipo" cascade="all">         <meta-value value="banco" class="br.com.leaftecnologia.lfadmin.model.financeiro.banco" />         <meta-value value="playsms" class="br.com.leaftecnologia.lfadmin.model.financeiro.cielo" />         <column name="tipo" />         <column name="financeira_id" /></any> 


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -