Reputation: 747
Hi i am facing some problem while i am trying to get the data my schema defined is as below
purchased.java
@SuppressWarnings("serial")
@Entity
@Table(name="purchased_listing")
@DiscriminatorValue(value="purchased")
public abstract class Purchased extends BaseDo implements Reportable {
public Purchased() {
super();
}
//some implementation
}
reportable.java
public interface Reportable {
}
and i have another class appointment.java like and i am mapping purchased with many to one mapping like below
appointment.java
@SuppressWarnings("serial")
@Entity
@Table(name="appointments")
@DiscriminatorColumn(name="class_code")
@DiscriminatorValue("appointment")
public class Appointment extends BaseDo implements Delivery {
public Appointment() {
}
@ManyToOne
@JoinColumn(name="purchased_id")
private Purchased purchased;
}
and interface delivery.java which appointment is implemented is like
public interface Delivery {
public long getId();
public DeliveryStatus getDeliveryStatus();
}
now actually when iam trying to query like
public Appointment getAppointmentInfoByAppointmentId(long id) throws DaoException {
Iterator<Appointment> itr = getHibernateTemplate().iterate(
"from Appointment app where app.id = ?", id);
if (itr.hasNext()) {
return itr.next();
}
throw new DaoException("No appointment found with id = " + id);
}
and when iam trying to inspect the return appointment object Iam getting like objectinvocation exception and in my code when iam trying to to like
appointment.getId();
Iam getting error like
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'purchased1_.DTYPE' in 'field list'
Struggling for this since one day couldn't get the solution so why iam facing this porblem and how to resolve this
Upvotes: 1
Views: 5547