Note that there are some explanatory texts on larger screens.

plurals
  1. POUnit testing of a unit of Application
    primarykey
    data
    text
    <p>Helloo please am running a unit test for my voucher class.i keep getting this error..</p> <pre><code>Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.dreamoval.itopup.voucher.model.VoucherType.VoucherCategory in com.dreamoval.itopup.voucher.model.VoucherCategory.voucherTypes at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:708) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:668) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66) at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1597) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1355) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) at org.hibernate.ejb.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:94) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) </code></pre> <p>this is the voucher class</p> <pre><code>@Entity(name = "voucher") public class Voucher { //declaration of variables with their annotations to map attributes of a voucher @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "voucher_id") private Long voucherId; @Column(name = "serial_number") private String serialNumber; @Column(name = "pin") private String pin; @ManyToOne @JoinColumn(name = "voucher_type_id") private VoucherType voucherTypeId; @Column(name = "denomination") private BigDecimal denomination; @Column(name = "session_lock") private Integer sessionLock; @Column(name = "status") private String status; @Column(name = "updated_by") private String updatedBy; @Temporal(javax.persistence.TemporalType.DATE) @Column(name = "expiry_date") private Date expiryDate; @Temporal(javax.persistence.TemporalType.DATE) @Column(name = "last_modified") private Date dateModified; @Temporal(javax.persistence.TemporalType.DATE) @Column(name = "date_entered") private Date dateEntered; @OneToOne(cascade = CascadeType.ALL,mappedBy = "Voucher") private PurchaseHistory purchaseHistory; /** * * @return voucherId */ public Long getVoucherId() { return voucherId; } /** * * @param voucherId the voucherId to be set to */ public void setVoucherId(Long voucherId) { this.voucherId = voucherId; } /** * * @return serialNumber */ public String getSerialNumber() { return serialNumber; } /** * * @param serialNumber the serialNumber to be set to */ public void setSerialNumber(String serialNumber) { this.serialNumber = serialNumber; } /** * * @return denomination */ public BigDecimal getDenomination() { return denomination; } /** * * @param denomination the denomination to be set to */ public void setDenomination(BigDecimal denomination) { this.denomination = denomination; } /** * * @return voucherTypeId */ public VoucherType getVoucherTypeId() { return voucherTypeId; } /** * * @param voucherTypeId the voucherTypeId to be set to */ public void setVoucherTypeId(VoucherType voucherTypeId) { this.voucherTypeId = voucherTypeId; } /** * * @return dateModified */ public Date getDateModified() { return dateModified; } /** * * @param dateModified the dateModified to be set to */ public void setDateModified(Date dateModified) { this.dateModified = dateModified; } /** * * @return dateEntered */ public Date getDateEntered() { return dateEntered; } /** * * @param dateEntered the dateEntered to be set to */ public void setDateEntered(Date dateEntered) { this.dateEntered = dateEntered; } /** * * @return expiryDate */ public Date getExpiryDate() { return expiryDate; } /** * * @param expiryDate the expiryDate to be set to */ public void setExpiryDate(Date expiryDate) { this.expiryDate = expiryDate; } /** * * @return pin */ public String getPin() { return pin; } /** * * @param pin the pin to be set to */ public void setPin(String pin) { this.pin = pin; } /** * * @return status */ public String getStatus() { return status; } /** * * @param status the status to be set to */ public void setStatus(String status) { this.status = status; } /** * * @return sessionLock */ public Integer getSessionLock() { return sessionLock; } /** * * @param sessionLock the sessionLock to be set to */ public void setSessionLock(Integer sessionLock) { this.sessionLock = sessionLock; } /** * * @return UpdatedBy */ public String getUpdatedBy() { return updatedBy; } /** * * @param updatedBy the name to be set to */ public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; } </code></pre> <p>} this is the voucherCategory Class</p> <pre><code>@Entity @Table(name = "voucher_category") public class VoucherCategory { //declaration of variables for attributes of the voucherCategory. @Id @Column(name = "category_id") private Long categoryId; @Column(name = "description") private String categoryDescription; @Column(name = "name") private String name; @Column(name = "update_by") private String updatedBy; @Temporal(javax.persistence.TemporalType.DATE) @Column(name = "last_modified") private Date dateModified; @OneToMany(cascade = CascadeType.ALL,orphanRemoval = true,mappedBy = "VoucherCategory") private final List&lt;VoucherType&gt; voucherTypes = new ArrayList&lt;VoucherType&gt;(); /** * @return the categoryId */ public Long getCategoryId() { return categoryId; } /** * @param categoryId the categoryId to set */ public void setCategoryId(Long categoryId) { this.categoryId = categoryId; } /** * @return the categoryDescription */ public String getCategoryDescription() { return categoryDescription; } /** * @param categoryDescription the CategoryDescription to set */ public void setCategoryDescription(String categoryDescription) { this.categoryDescription = categoryDescription; } /** * @return the dateModified */ public Date getDateModified() { return dateModified; } /** * @param dateModified the DateModified to set */ public void setDateModified(Date dateModified) { this.dateModified = dateModified; } /** * @return the upadatedBy */ public String getUpddateBy() { return updatedBy; } /** * @param updatedBy the UpdatedBy to set */ public void setUpddateBy(String updatedBy) { this.updatedBy = updatedBy; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } </code></pre> <p>this the voucherType class</p> <pre><code>@Entity </code></pre> <p>@Table(name = "voucher_type") public class VoucherType {</p> <pre><code>//declaration of variables for attributes of the VoucherType,specifying the various fields in the table @Id @Column(name = "voucher_type_id") private long typeID; @ManyToOne @JoinColumn(name = "category_id") private VoucherCategory voucherCategory; @Column(name = "last_modified") @Temporal(javax.persistence.TemporalType.DATE) private Date lastModified; @Column(name = "picture") private String voucherImageUrl; @Column(name = "updated_by") private String updatedBy; @OneToMany(cascade = CascadeType.ALL,orphanRemoval = true,mappedBy = "VoucherType") private final List&lt;Voucher&gt; vouchers = new ArrayList&lt;Voucher&gt;(); /** * * @return the typeID */ public long getTypeID() { return typeID; } /** * * @param typeID the typeID to set */ public void setTypeID(long typeID) { this.typeID = typeID; } /** * * @return the voucherImageUrl */ public String getVoucherImageUrl() { return voucherImageUrl; } /** * * @param voucherImageUrl the voucherImageUrl to set */ public void setVoucherImageUrl(String voucherImageUrl) { this.voucherImageUrl = voucherImageUrl; } /** * * @return the lastModified */ public Date getLastModified() { return lastModified; } /** * * @param lastModified the lastModified to set */ public void setLastModified(Date lastModified) { this.lastModified = lastModified; } /** * * @return the updatedBy */ public String getUpdatedBy() { return updatedBy; } /** * * @param updatedBy the updatedBy to set */ public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; } } } </code></pre> <p>this is th content of my test-db-config.xml file</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema /data/jpa/spring-jpa-1.0.xsd http://www.springframework.org/schema/tx"&gt; &lt;context:component-scan base-package="com.dreamoval.itopup.voucher" /&gt; &lt;bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="locations"&gt; &lt;list&gt; &lt;value&gt;classpath:/META-INF/voucher.properties&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="${jdbc.driverClassName}" /&gt; &lt;property name="url" value="${jdbc.url}" /&gt; &lt;property name="username" value="${jdbc.username}"/&gt; &lt;property name="password" value="${jdbc.password}" /&gt; &lt;/bean&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt; &lt;/bean&gt; &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;property name="packagesToScan" value="com.dreamoval.itopup.voucher.model"/&gt; &lt;property name="persistenceUnitName" value="defaultPersistenceUnit" /&gt; &lt;property name="jpaProperties"&gt; &lt;props&gt; &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt; &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt; &lt;prop key="hibernate.format_sql"&gt;${hibernate.format_sql}&lt;/prop&gt; &lt;prop key="hibernate.hbm2ddl.auto"&gt;${hibernate.hbm2ddl.auto}&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="jpdDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/&gt; &lt;jpa:repositories base-package="com.dreamoval.itopup.voucher.repository"/&gt; &lt;/beans&gt; </code></pre> <p>can anyon help me please...am waiting</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload