Hi!
I've got a class named Ficha whith a set of objects of another class named Tarifa. Like this:
@Indexed public class FichaDeTarifa { ....... @Id @DocumentId protected Long idFicha;
@OneToMany(mappedBy = "fichaDeTarifa", fetch = FetchType.EAGER, cascade = CascadeType.ALL) @org.hibernate.annotations.Cascade( { org.hibernate.annotations.CascadeType.DELETE_ORPHAN }) @javax.persistence.Column(nullable = false) @IndexedEmbedded @Boost(20.5f) protected Set<AbstractTarifa> tarifas = new HashSet<AbstractTarifa>();
...... }
@Entity(name = "tarifa") @Indexed public abstract class AbstractTarifa {
...... @Id @GeneratedValue(strategy = GenerationType.AUTO) @DocumentId protected Long idTarifa;
@ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "ficha_tarifa_id") @NotNull @ContainedIn private FichaDeTarifa fichaDeTarifa; @OneToMany(mappedBy = "tarifa", fetch = FetchType.EAGER, cascade = CascadeType.ALL) @org.hibernate.annotations.Cascade ({ org.hibernate.annotations.CascadeType.DELETE_ORPHAN }) @IndexedEmbedded @Boost(10.5f) protected Set<AbstractSubtarifa> subtarifas = new HashSet<AbstractSubtarifa>(); ..... }
@Entity(name = "subtarifa") @Indexed public abstract class AbstractSubtarifa{ ..... @Id @GeneratedValue(strategy = GenerationType.AUTO) @DocumentId protected Long idSubtarifa;
@ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "tarifa_id") @NotNull @ContainedIn privateTarifa tarifa; ..... }
I'm working with queries about FichaDeTarifa class, I mean, I want to retrieve lists of FichaDeTarifa objects. If I create a subtarifa using my application and I add it to a Tarifa -created as well using my application- and I add it to a FichaDeTarifa -created using my application as well-, when I search in Tarifa's fields, I find results but, if I search in Subtarifa's fields, I don't find any result.
However, if a do manual indexing -i mean, not using the application- the queries return results -about the Subtarifa's fields-. That's why I think the annotations are correct.
Thanks a lot.
|