Hibernate version: 3.1
Friends,
I am sorry if this is a very trivial and oft-repeated problem. I did look around a little and could not find anything very helpful. Pl help.
I am running into a problem when trying to save an entity extending from an abstract base class which simply holds the primary ID (common to all entities). Here is my code :
Parent Class
Code:
public abstract class BaseEntity<T extends java.io.Serializable> {
private T id;
public T getId() {return this.id;}
public void setId(T id) {this.id = id;}
}
Child ClassCode:
public class Address<Integer> extends BaseEntity {
String addressText, city;
public String getAddressText() {
return addressText;
}
public void setAddressText(String addressText) {
this.addressText = addressText;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
}
There may be other implementations of the BaseEntity as well.
The mapping file for Address (using the table-per-concrete-class strategy) :
Code:
<hibernate-mapping package="com.vca.paws.datamodel" >
<class name="Address" table="Address" polymorphism="implicit">
<id name="id" type="integer" unsaved-value="null" >
<column name="id" not-null="true"/>
<generator class="increment"/>
</id>
<property column="addressText" name="addressText" type="string" not-null="true"/>
<property column="city" name="city" type="string" not-null="true"/>
</hibernate-mapping>
Now, when I try to save or update an Address entity, I get the below error :
Code:
Could not execute JDBC batch update; bad SQL grammar [update Address set addressText=?, city=? where id=?]; nested exception is java.sql.BatchUpdateException: No value specified for parameter
Could you pl point me where I am going wrong ?
Anyinputs would be most welcome !
Thanks.[/code]