无法获取hibernate记录

时间:2014-02-20 13:03:23

标签: java hibernate jpa

您好我有以下表格:

CREATE TABLE `tr_prop_book` (
  `ID` bigint(12) NOT NULL AUTO_INCREMENT,
  `OWNER_ID` int(11) NOT NULL,
  `START_DATE` datetime NOT NULL,
  `END_DATE` datetime NOT NULL,
  `USER_ID` int(11) NOT NULL,
  `USER_OFFER_RATE` double NOT NULL,
  `COMMENTS_TO_OWNER` varchar(250) DEFAULT NULL,
  `IS_ACCEPTED` int(1) NOT NULL,
  `PROP_ID` int(11) NOT NULL,
  `LAST_MODIFIED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `CALCULATED_VALUE` double DEFAULT NULL,
  `RULE_TRIGGERED` varchar(200) DEFAULT NULL,
  `STATUS` int(11) DEFAULT NULL,
  `TOTAL_FOR_OWNER` double DEFAULT '0',
  `OWNER_FEE` double DEFAULT NULL,
  `CHARGES` double DEFAULT NULL,
  `POLICY_ACCEPTED` int(11) DEFAULT NULL,
  `TRANSACTION_STATUS` varchar(100) DEFAULT NULL,
  `GUEST` int(11) DEFAULT NULL,
  `PETS` int(11) DEFAULT NULL,
  `EMAIL_SEND_DATE` datetime DEFAULT NULL,
  `CREATE_DATE` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `ISASK_PRICE` int(11) DEFAULT NULL,
  `CLEANING_FEE` double DEFAULT '0',
  `FIXED_FEE` double DEFAULT '0',
  `PET_FEE` double DEFAULT '0',
  `RENTAL_TOTAL` double DEFAULT NULL,
  `SPA_FEE` double DEFAULT '0',
  `DAMAGE_WAIVER` double DEFAULT '0',
  `OTHER_FEE` double DEFAULT NULL,
  `TAX_FOR_OWNER` double DEFAULT NULL,
  `INSURED_PREMIUM` double DEFAULT NULL,
  `IS_INSURANCE` int(11) NOT NULL DEFAULT '0',
  `BOOK_QUEUE_ID` int(11) DEFAULT NULL,
  `DIRECT_PAYMENT_TYPE` varchar(45) DEFAULT NULL,
  `BOOKING_NUMBER` varchar(20) DEFAULT NULL,
  `TOTAL_CHARGED_USER` double DEFAULT NULL,
  `TAX_CHARGED_USER` double DEFAULT NULL,
  `TRANSACTION_FEE` double DEFAULT NULL,
  `PAYMENT_CHARGES_FRM_OWNER` double DEFAULT NULL,
  `ACCEPTED_EMAIL_SEND_FLAG` int(11) DEFAULT '0',
  `DISCOUNT_AMOUNT` double DEFAULT '0',
  `REMITTANCE_AMOUNT` double DEFAULT '0',
  `REMITTANCE_DATE` datetime DEFAULT NULL,
  `PMS_BOOKING_NUMBER` varchar(50) DEFAULT NULL,
  `INSURANCE_POLICY_NUMBER` varchar(100) DEFAULT NULL,
  `CHARGED_AMOUNT` double DEFAULT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `BOOKING_NUMBER` (`BOOKING_NUMBER`)
) ENGINE=MyISAM AUTO_INCREMENT=437 DEFAULT CHARSET=latin1;

相应的域类如下:

@Entity
@Table(name="tr_prop_book")
public class TrPropBook extends AuditedEntity<Long> implements Serializable{
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;

@Column(name="ACCEPTED_EMAIL_SEND_FLAG")
private Integer acceptedEmailSendFlag;

@Column(name="BOOK_QUEUE_ID")
private Integer bookQueueId;

@Column(name="BOOKING_NUMBER")
private String bookingNumber;

@Column(name="CALCULATED_VALUE")
private double calculatedValue;

@Column(name="CLEANING_FEE")
private double cleaningFee;

@Column(name="COMMENTS_TO_OWNER")
private String commentsToOwner;

@Column(name="CREATE_DATE")
private Timestamp createDate;

@Column(name="DAMAGE_WAIVER")
private double damageWaiver;

@Column(name="DIRECT_PAYMENT_TYPE")
private String directPaymentType;

@Column(name="DISCOUNT_AMOUNT")
private double discountAmount;

@Column(name="EMAIL_SEND_DATE")
private Date emailSendDate;

@Column(name="END_DATE")
private Date endDate;

@Column(name="FIXED_FEE")
private double fixedFee;

@Column(name="GUEST")
private Integer guest;

@Column(name="INSURANCE_POLICY_NUMBER")
private String insurancePolicyNumber;

@Column(name="INSURED_PREMIUM")
private double insuredPremium;

@Column(name="IS_ACCEPTED")
private Integer isAccepted;

@Column(name="IS_INSURANCE")
private Integer isInsurance;

@Column(name="ISASK_PRICE")
private Integer isaskPrice;

@Column(name="LAST_MODIFIED")
private Timestamp lastModified;

@Column(name="OTHER_FEE")
private double otherFee;

@Column(name="OWNER_FEE")
private double ownerFee;

@Column(name="OWNER_ID")
private Integer ownerId;

@Column(name="PAYMENT_CHARGES_FRM_OWNER")
private double paymentChargesFrmOwner;

@Column(name="PET_FEE")
private double petFee;

@Column(name="PETS")
private Integer pets;

@Column(name="PMS_BOOKING_NUMBER")
private String pmsBookingNumber;

@Column(name="POLICY_ACCEPTED")
private Integer policyAccepted;

@Column(name="PROP_ID")
private Integer propId;

@Column(name="REMITTANCE_AMOUNT")
private double remittanceAmount;

@Column(name="REMITTANCE_DATE")
private Date remittanceDate;

@Column(name="RENTAL_TOTAL")
private double rentalTotal;

@Column(name="RULE_TRIGGERED")
private String ruleTriggered;

@Column(name="SPA_FEE")
private double spaFee;

@Column(name="START_DATE")
private Date startDate;

@Column(name="STATUS")
private Integer status;

@Column(name="TAX_CHARGED_USER")
private double taxChargedUser;

@Column(name="TAX_FOR_OWNER")
private double taxForOwner;

@Column(name="TOTAL_CHARGED_USER")
private double totalChargedUser;

@Column(name="TOTAL_FOR_OWNER")
private double totalForOwner;

@Column(name="TRANSACTION_STATUS")
private String transactionStatus;

@Column(name="USER_ID")
private Integer userId;

@Column(name="USER_OFFER_RATE")
private double userOfferRate;

@Column(name="CHARGED_AMOUNT")
private double chargedAmount;

@Column(name="CHARGES")
private double charges;

@Column(name="TRANSACTION_FEE")
private double transactionFee;

// getter/setters

}

在dao层我试图从表中获取数据,但我没有得到任何数据。 这是dao层代码:

List<TrPropBook> trPropBooks = getHibernateTemplate().loadAll(TrPropBook.class);

如果我使用的是我们项目中已存在的其他域类,我可以获取数据。像:

List<Review> Reviews = getHibernateTemplate().loadAll(Review.class);

任何人都可以指导我出错的地方吗?

0 个答案:

没有答案