I'm using Spring 3.2.3, JPA 2.1, JUnit 4.11. I'm trying to run a junit test and I keep getting the abstract schema type is unknown error. Here is my entity (truncated for space, it has all the getters and setters):
@Entity
@Table(name = "WEB_PROFILES")
public class TestWebProfile implements Serializable {
private static final long serialVersionUID = 1L;
@Transient
private String forward;
@Column(name = "ACCESS_FLAG")
private String accessFlag;
@Temporal(TemporalType.DATE)
@Column(name = "ACCESS_FLAG_UPD_DATE")
private Date accessFlagUpdDate;
@Column(name = "ACCESS_RESET_INTERVAL")
private BigDecimal accessResetInterval;
@Column(name = "ACCOUNT_TYPE")
private String accountType;
@Column(name = "CREATED_BY")
private String createdBy;
@Column(name = "E_MAIL")
private String eMail;
@Column(name = "FAILED_LOGIN_ATTEMPTS")
private BigDecimal failedLoginAttempts;
@Column(name = "FIRST_NAME")
private String firstName;
@Temporal(TemporalType.DATE)
@Column(name = "FROI_ACCESS_APPROVE_DENY_DATE")
private Date froiAccessApproveDenyDate;
@Column(name = "FROI_ACCESS_APPROVED_FLAG")
private String froiAccessApprovedFlag;
@Column(name = "FROI_ACCESS_REQUESTED")
private String froiAccessRequested;
@Column(name = "FROI_APPROVED_BY")
private String froiApprovedBy;
@Temporal(TemporalType.DATE)
@Column(name = "FROI_CONFIRM_EMAIL_SENT_DATE")
private Date froiConfirmEmailSentDate;
@Temporal(TemporalType.DATE)
@Column(name = "FROI_LETTER_SENT_DATE")
private Date froiLetterSentDate;
@Column(name = "LAST_LOGON_ADDR")
private String lastLogonAddr;
@Temporal(TemporalType.DATE)
@Column(name = "LAST_LOGON_DATE")
private Date lastLogonDate;
@Column(name = "LAST_NAME")
private String lastName;
@Column(name = "LAST_UPDATED_BY")
private String lastUpdatedBy;
@Column(name = "LAST_UPDATED_BY_NAME")
private String lastUpdatedByName;
@Column(name = "LAST_UPDATED_BY_SU_ID")
private BigDecimal lastUpdatedBySuId;
@Temporal(TemporalType.DATE)
@Column(name = "MAIL_SENT_DATE")
private Date mailSentDate;
@Temporal(TemporalType.DATE)
@Column(name = "MAINT_DATE")
private Date maintDate;
@Temporal(TemporalType.DATE)
@Column(name = "NEW_PIN_REQ_DATE")
private Date newPinReqDate;
@Column(name = "PASSWORD")
private String password;
@Transient
private String newPassword;
@Temporal(TemporalType.DATE)
@Column(name = "PASSWORD_UPD_DATE")
private Date passwordUpdDate;
@Column(name = "PHONE")
private String phone;
@Column(name = "PIN")
private String pin;
@Column(name = "POLICY_NUM")
private BigDecimal policyNo;
@Column(name = "PROFILE_CLASS_CODE")
private String profileClassCode;
@Temporal(TemporalType.DATE)
@Column(name = "PROFILE_REQ_DATE")
private Date profileReqDate;
@Temporal(TemporalType.DATE)
@Column(name = "PROFILE_UPDATE_DATE")
private Date profileUpdateDate;
@Column(name = "REMOTE_ADDR")
private String remoteAddr;
@Column(name = "SESSIONID")
private String sessionid;
@Column(name = "SUBSCRIBER_FLAG")
private String subscriberFlag;
@Column(name = "USER_ID")
private BigDecimal userId;
@Id
@Column(name = "USER_NO")
private BigDecimal userNo;
@Column(name = "USERNAME")
private String username;
My JUnit test:
@Test
public void testGetWebProfileByUsername() {
TestWebProfile wp = sso.getWebProfile("MARLENE");
System.out.println("name :" + wp.getFirstName());
System.out.println("last name :" + wp.getLastName());
}
My DAO implementation:
@Override
public TestWebProfile getWebProfile(String username) {
String sqlString = "select w from TestWebProfile w where w.username =:username";
return (TestWebProfile) getEntityManager()
.createQuery(sqlString, TestWebProfile.class)
.setParameter("username", username).getSingleResult();
}
After Googling for the past hour, the only culprit I found that seem to make sense was not having the @Id and @Column annotations, but I have those on the userNo variable. Any help that can be provided would be greatly appreciated!
Have a look at this. It gives some suggesstion for the same case http://java.dzone.com/tips/the-nasty-jpa-unknown-abstract
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With