openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hvieren <herman.vierende...@gmail.com>
Subject openjpa entity remove does unnecessary load of ManyToOne field ?
Date Fri, 19 Oct 2012 11:11:18 GMT
Hello,

I would like to understand why openjpa, on remove of entity, does
still load of  ManyToOne field?
And how one could tell openjpa not to do this?
(i have been playing , but without results;  with
  <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>
   <property name="openjpa.jdbc.MappingDefaults"
value="ForeignKeyDeleteAction=null,JoinForeignKeyDeleteAction=null"/>
)


i have

definitions begin

class COUNTRIES
 @Id
 @Column(name="CCD",length=3,nullable=false)
 public String CCD=null;
 .....


class CITIES
 @GeneratedValue(strategy=GenerationType.IDENTITY)
  @Id
  @Column(name="CITYKEY",length=10,nullable=false)
  public Integer CITYKEY=null;
 @Basic(fetch=FetchType.EAGER)
 @Column(name="CCD",length=3,nullable=false)
 public String CCD=null;
 ......
 ......
 @ManyToOne(fetch=FetchType.LAZY,targetEntity=entities.APP.COUNTRIES.class,optional=true)
 @JoinColumn(name="CCD")
 public COUNTRIES cOUNTRIES_CCD_i=null;

definitions end


when i remove CITIES-entity:
 (at that moment CITYKEY is still NULL,neither does it belong to fetchGroup)

 pc=em.find(class,oid)
 em.remove(pc);
 em.flush()

In the log i see:


20877  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQLDiag
- getInitializeStateResult: oid=142 class entities.APP.CITIES
20878  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQL - <t
222406467, conn 57188268> executing prepstmnt 1497156246 SELECT
t0.CCD, t0.CITYCD, t0.CITYNM FROM APP.CITIES t0 WH
ERE t0.CITYKEY = ? [params=?]
20879  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQL - <t
222406467, conn 57188268> [1 ms] spent
Oct 19, 2012 12:47:46 PM h4.projects.website1.mainController doGet
INFO: pc=entities.APP.CITIES@5e7408d9 oid=142
20880  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQLDiag
- flush: org.apache.openjpa.kernel.PDeletedState for oid=142
20880  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQLDiag
- load field: 'cOUNTRIES_CCD_i' for oid=142 class entities.APP.CITIES
20880  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQLDiag
- find: oid=BEL class entities.APP.COUNTRIES
20881  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQL - <t
222406467, conn 57188268> executing prepstmnt 923800801 SELECT t0.CNM
FROM APP.COUNTRIES t0 WHERE t0.CCD = ? [para
ms=?]
20881  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQL - <t
222406467, conn 57188268> [0 ms] spent
20882  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQL - <t
222406467, conn 57188268> executing prepstmnt 1897591226 DELETE FROM
APP.CITIES WHERE CITYKEY = ? [params=?]
20883  hoefsmidb  TRACE  [http-bio-8080-exec-55] openjpa.jdbc.SQL - <t
222406467, conn 57188268> [1 ms] spent


Many thanks in advance

Herman Vierendeels




--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-entity-remove-does-unnecessary-load-of-ManyToOne-field-tp7581482.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message