-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Making a query in fields of a subclass of a subclass
PostPosted: Thu Apr 24, 2008 9:08 am 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.