私はFKと親 "トランザクション"テーブルを含む "transactionitems"テーブルテーブルを持っています。私はトランザクションの行を解決する "transactionitems"テーブルを照会することに問題はありません。しかし、私がトランザクションテーブルへの直接クエリを行うとき、私は結果を戻しません。コンソールにエラーや例外が表示されません。単純な休止状態ではないがカスケードクエリは
は、次のようなメソッド呼び出しは、実際に
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.beraben.drycleanpos3.entities.Transaction" table="transactions">
<id column="id" name="id">
<generator class="increment"/>
</id>
<property name="customerName" column="customer_name"/>
<property name="customerContact" column="customer_contact"/>
<property name="createdDate" type="date" column="created_datetime"/>
<property name="dueDate" type="date" column="due_datetime"/>
<property name="readyDate" type="date" column="ready_datetime"/>
<property name="jobClosedDate" type="date" column="job_closed_datetime"/>
<property name="notes" />
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.beraben.drycleanpos3.entities.TransactionItem" table="transaction_items">
<id column="id" name="id">
<generator class="increment"/>
</id>
<many-to-one class="com.beraben.drycleanpos3.entities.Transaction" column="transaction_id" name="transaction" cascade="merge" not-null="true" />
<property name="garmentTypeName" column="garment_type_name"/>
<property name="jobTypeName" column="job_type_name"/>
<property name="price"/>
<property name="notes"/>
</class>
</hibernate-mapping>
public class TransactionItem {
private int id;
private Transaction transaction;
private String garmentTypeName;
private String jobTypeName;
private int price;
private String notes;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Transaction getTransaction() {
return transaction;
}
public void setTransaction(Transaction transaction) {
this.transaction = transaction;
}
public String getGarmentTypeName() {
return garmentTypeName;
}
public void setGarmentTypeName(String garmentTypeName) {
this.garmentTypeName = garmentTypeName;
}
public String getJobTypeName() {
return jobTypeName;
}
public void setJobTypeName(String jobTypeName) {
this.jobTypeName = jobTypeName;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
}
public class Transaction {
private int id;
private String customerName;
private String customerContact;
@JsonSerialize(using = CustomDateSerializer.class)
private Date createdDate;
@JsonSerialize(using = CustomDateSerializer.class)
private Date dueDate;
@JsonSerialize(using = CustomDateSerializer.class)
private Date readyDate;
@JsonSerialize(using = CustomDateSerializer.class)
private Date jobClosedDate;
private String notes;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerContact() {
return customerContact;
}
public void setCustomerContact(String customerContact) {
this.customerContact = customerContact;
}
@JsonSerialize(using = CustomDateSerializer.class)
public Date getCreatedDate() {
return createdDate;
}
@JsonSerialize(using = CustomDateSerializer.class)
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
@JsonSerialize(using = CustomDateSerializer.class)
public Date getDueDate() {
return dueDate;
}
@JsonSerialize(using = CustomDateSerializer.class)
public void setDueDate(Date dueDate) {
this.dueDate = dueDate;
}
@JsonSerialize(using = CustomDateSerializer.class)
public Date getReadyDate() {
return readyDate;
}
@JsonSerialize(using = CustomDateSerializer.class)
public void setReadyDate(Date readyDate) {
this.readyDate = readyDate;
}
@JsonSerialize(using = CustomDateSerializer.class)
public Date getJobClosedDate() {
return jobClosedDate;
}
@JsonSerialize(using = CustomDateSerializer.class)
public void setJobClosedDate(Date jobClosedDate) {
this.jobClosedDate = jobClosedDate;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
@Override
public String toString() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
return "Transaction{" + "id=" + id + ", customerName=" + customerName + ", customerContact=" + customerContact + ", createdDate=" + sdf.format(createdDate) + ", dueDate=" + sdf.format(dueDate) + ", readyDate=" + readyDate + ", jobClosedDate=" + jobClosedDate + ", notes=" + notes + '}';
}
TransactionItemの条件は、トランザクションデータを含むすべてのTransactionItemデータを使用できるようになります。 Transactionの基準は結果リストに要素を返しませんが、実際のトランザクションテーブルには70を超えるレコードがあります。 –
最後に生成されたSQL文をログからチェックしましたか? – ajoshi