openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jude <meetj...@gmail.com>
Subject Inserts generated for one child but not the other
Date Fri, 27 Jul 2012 18:43:58 GMT
This is similar to another post I posted sometime back today but the issue is
different.

Following is the relationship I work with, 

Tables: ui_qtrly_payable, ui_fees_payable, ui_penalty_payable 
Relationship: one to many from ui_qtrly_payable to ui_fees_payable 
			  one to many from ui_qtrly_payable to ui_penalty_payable 
Keys: ui_qtrly_payable.primary key = payableId 
        ui_fees_payable.primary key = feeNum 
        ui_fees_payable.foreignKey = payableId 
		ui_penalty_payable.primary key = penaltyNum
        ui_penalty_payable.foreignKey = payableId 
Mappings in entities:

UI_Qtrly_Payable: 
@Id 
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
"UiQtrlyPayableSeq") 
@Column(name = "PAYABLE_ID") 
private Long payableId; 

@OneToMany(mappedBy = "qtrlyPayable", targetEntity =
UiQtrlyFeesPayable.class, cascade = CascadeType.ALL, fetch =
FetchType.EAGER) 
private List<UiQtrlyFeesPayable> fees; 

UI_Qtrly_Fees: 
@Id 
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
"UiQtrlyFeesPayableSeq") 
@Column(name = "FEE_NUM") 
private Long feeNum; 

@ManyToOne 
@JoinColumn(name = "PAYABLE_ID", referencedColumnName = "PAYABLE_ID") 
private UiQtrlyPayable qtrlyPayable; 

UI_Qtrly_Penalty: 
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
"UiQtrlyPenaltyPayableSeq")
@Column(name = "PENALTY_NUM")
private Long penaltyNum;

@ManyToOne
@JoinColumn(name = "PAYABLE_ID", referencedColumnName = "PAYABLE_ID")
private UiQtrlyPayable qtrlyPayable;
	
Steps in creating objects:
1) Create ui_qtrly_payable  obj without setting the payableId 
2) Create ui_fees_payable obj without setting the feeNum or payableId but
setting the ui_qtrly_payable obj created in step 1 
3) Add ui_fees_payable obj created in step 2 to ui_qtrly_payable  obj 
4) Create ui_penalty_payable obj without setting the penaltyNum or payableId
but setting the ui_qtrly_payable obj created in step 1 
5) Add ui_penalty_payable obj created in step 4 to ui_qtrly_payable  obj 
6) save ui_qtrly_payable obj 

Log:
7864  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> executing prepstmnt 315888340 SELECT ui_payable_seq.NEXTVAL
FROM DUAL
7886  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> [22 ms] spent
7892  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> executing prepstmnt 272044087 SELECT
UI_PAYABLE_FEE_SEQ.NEXTVAL FROM DUAL
7945  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> [53 ms] spent
7946  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> executing prepstmnt 1450661495 SELECT
UI_PAYABLE_PENALTY_SEQ.NEXTVAL FROM DUAL
8029  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> [82 ms] spent
8048  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> executing prepstmnt 72287311 INSERT INTO UI_QTRLY_PAYABLE
(PAYABLE_ID, CREATE_DT, CREATE_USER, MDFCTN_DT, MDFCTN_USER, ADD_SURCHARGE,
BATCH_NU, BNFT_CHRG_CREDIT, BUS_ACCT_HOLDER_NA, CCYYQ_ID, CONTRIBUTION,
CREDIT_AM, CREDIT_PENDING_AM, DUE_DT, EMERG_SURCHARGE, EMPR_ACCT_ID,
FIRST_NA, LAST_NA, MERIT_LATE_AM, NON_REFUNDABLE_AM, PAYABLE_940_1,
PAYABLE_940_2, PAYMENT_DT, PAYMENT_NU, PLAN_ID, PMT_METHOD_CD, QTRLY_AGING,
REASON, RESERVE_FUND, RMB_CHARGES, RPT_QTR, RPT_YR, SCHEDULE_DT, TAX_TYPE,
TOTAL_FEES, TOTAL_INTEREST, TOTAL_PENALTY, TRANS_NU, UPDATE_NU, WORKFLOW_ID)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(long) 4616923,
(Timestamp) 2012-07-27 13:35:39.392, (String) j, (Timestamp) 2012-07-27
13:35:39.392, (String) j, (BigDecimal) 999.99, (String) j, (BigDecimal)
999.99, (String) j, (int) 20101, (BigDecimal) 999.99, (BigDecimal) 999.99,
(BigDecimal) 999.99, (Timestamp) 2012-07-27 13:35:39.392, (BigDecimal)
999.99, (long) 372691, (String) j, (String) j, (BigDecimal) 999.99,
(BigDecimal) 999.99, (BigDecimal) 999.99, (BigDecimal) 999.99, (Timestamp)
2012-07-27 13:35:39.392, (long) 3699638, (long) 999, (String) j, (int) 9,
(String) j, (BigDecimal) 999.99, (BigDecimal) 999.99, (int) 1, (int) 2010,
(Timestamp) 2012-07-27 13:35:39.392, (String) j, (BigDecimal) 999.99,
(BigDecimal) 999.99, (BigDecimal) 999.99, (String) j, (int) 9, (String) j]
8104  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> [56 ms] spent
8105  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> executing prepstmnt 943339578 INSERT INTO
UI_QTRLY_FEES_PAYABLE (FEE_NUM, CREATE_DT, CREATE_USER, FEE_DATE, FEE_TYPE,
MDFCTN_DT, MDFCTN_USER, TOTAL_FEES, UPDATE_NU, PAYABLE_ID) VALUES (?, ?, ?,
?, ?, ?, ?, ?, ?, ?) [params=(long) 2865, (Timestamp) 2012-07-27
13:35:39.392, (String) XX, (Timestamp) 2012-07-27 13:35:39.392, (String)
SHERIFF, (Timestamp) 2012-07-27 13:35:39.392, (String) XX, (null) null,
(int) 0, (long) 4616923]
8181  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> [76 ms] spent
8183  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> executing prepstmnt 1613258792 INSERT INTO
UI_QTRLY_FEES_PAYABLE (FEE_NUM, CREATE_DT, CREATE_USER, FEE_DATE, FEE_TYPE,
MDFCTN_DT, MDFCTN_USER, TOTAL_FEES, UPDATE_NU, PAYABLE_ID) VALUES (?, ?, ?,
?, ?, ?, ?, ?, ?, ?) [params=(long) 2865, (Timestamp) 2012-07-27
13:35:39.392, (String) XX, (Timestamp) 2012-07-27 13:35:39.392, (String)
SHERIFF, (Timestamp) 2012-07-27 13:35:39.392, (String) XX, (null) null,
(int) 0, (long) 4616923]
8188  uitaxPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 1194084140,
conn 600777679> [5 ms] spent


Exception:
Caused by: <openjpa-2.0.2-SNAPSHOT-r422266:1084264 fatal store error>
org.apache.openjpa.persistence.EntityExistsException: ORA-02291: integrity
constraint (UITAX_PAYMENT.FK_QTR_F_P_Q_PAYA_1) violated - parent key not
found 
... 
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-02291:
integrity constraint (UITAX_PAYMENT.FK_QTR_F_P_Q_PAYA_1) violated - parent
key not found 

UITAX_PAYMENT.FK_QTR_F_P_Q_PAYA_1  -  this is the foreign key constraint for
PayableId. 

In addition to the integrity constraint exception, I see 2 insert statements
to UI_QTRLY_FEES_PAYABLE table. Instead it should be 1 for
UI_QTRLY_FEES_PAYABLE and 1 for UI_QTRLY_PENALTY_PAYABLE.
Please advice why this insert is not working and also about incorrect insert
statements. I can provide further info if required.



--
View this message in context: http://openjpa.208410.n2.nabble.com/Inserts-generated-for-one-child-but-not-the-other-tp7580762.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Mime
View raw message