I have an entity bean X similar to the following:
@Entity
@SequenceGenerator(name = "FRAUD_CASENUMBER_SEQ", sequenceName = "FRAUD_CASENUMBER_SEQ")
public class Tblcase implements Serializable {
// LOBS
@Lob
@Basic(fetch=FetchType.LAZY)
public String fraudfindingnotes;
.
.
//REGULAR FIELDS
public BigDecimal mgmtrvdother;
.
.
//LOOKUP TABLES
@OneToOne
@JoinColumn(name = "CHRFRAUDCODE", referencedColumnName = "CHRFRAUDCODE", insertable = false, updatable = false)
public TblmatrixFraudcode tblmatrixFraudcode;
@OneToOne
@JoinColumn(name = "NAME", referencedColumnName = "NAME", insertable = false, updatable = false)
public Tbluser tbluser;
@OneToOne
@JoinColumn(name = "CASETYPECD", referencedColumnName = "CASETYPECD", insertable = false, updatable = false)
public Tblcasetyperef tblcasetyperef;
.
.
.
.
}
What I want to do is return a list of the above entity bean BUT I want it to only hold the PK, AND a few one-to-one fields instead of the all the fields in the entity bean - I dont need complete entities up front; The issue is that a select * statement for the entity takes way to long when I have many rows. When I remove the lobs from the select statement, the execution time is reduced measurably - and no, there is no table scanning going on.
Does someone have an example of syntax for a jpql statment that will allow me to select specific fields - some fields being one-to-one relationships, using an outer join. The statement will run and load the above entity bean with those selected fields so that I have a list of entity beans. Later on, when a row is selected by the user, I can load the full entity bean for the PK he selected