[jboss-user] [EJB 3.0] - JPQL syntax question - entity bean loading

X490812 do-not-reply at jboss.com
Tue Oct 30 19:51:18 EDT 2007


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100471#4100471

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100471



More information about the jboss-user mailing list