Hello Everybody ,
I am new to this forum .Actually I am using table per sub class concept in hibernate.
i am pasting my pojo information and hbm.xml information here plz suggest me where i did mistake ?
here below i pasted the information. Subclass is userserviceprovider I need to update the userserviceprovider table using userid(foreign key ) it belongs to user table. I am not using primarykey of userserviceprovider table for update
Plz tel me what is the mistake in hbm file
this is super class......
public class User implements Serializable{
public static final String INDIVIDUAL = "individual";
public static final String NGO = "ngo";
public static final String SERVICE_PROVIDER = "serviceprovider";
public static final String ADMIN = "admin";
// ----------------------------------------------------
// NOTE: Whenever you add a new state to User, remember
// to add it setUser() API. It's used by Searching API.
// ----------------------------------------------------
private Long userId;
private String password;
private String email;
private String headLines;
private String website;
private String status;
private String screenName;
private String type;
private String token;
private int spamCount;
private String homeTown;
private UserAddress userAddress;
private Date dateCreated;
private String createdBy;
private Date dateModified;
private String modifiedBy;
public User() {
}
this is sub class of user.
public class UserServiceProvider extends User {
//Member variables
private Long serviceprovid;
private String companyName;
private String contactName;
private String phoneno;
private ArrayList specialitiesList;
private String website;
private String instantMessagingIds;
private String showImIds;
private ArrayList serviceProvidedList;
private String otherServicesProvided;
private List<String> speciliaties;
private String otherSpecialities;
private String companyProfile;
private String moreInformation;
private String yearfounded;
private String keywords;
private String messagealert;
private String newsletter;
private String certificate;
private List<String> travelStyle;
private String travelStylesAsString;
private String otherTravelStyle;
private List<String> serviceProvided;
private String serviceProvideAsString;
this is hbm file for userserviceprovider.
<class name="com.zicasso.model.entity.user.UserServicePro vider" table="zicasso_user_service_provider" >
<id name="userId" column = "user_id" > here userid is in user table. i need to store into zicasso_user_service_provider table.
how to map plz check it . And user_id is the foreignkey in this table. I am not using primary key to update this table.
<!-- MySQL generator for a increment field -->
<generator class="identity"/>
</id>
<property name="companyName" column="company_name"></property>
<property name="contactName" column="contact_name" ></property>
<property name="phoneno" column="phone_no" ></property>
<property name="website" column="website" ></property>
<property name="instantMessagingIds" column="im_id" ></property>
<property name="serviceProvidedAsString" column="service_provided" ></property>
<property name="otherServicesProvided" column="other_service_provided" ></property>
<property name="speciliatieAsString" column="specialities" ></property>
<property name="otherSpecialities" column="other_specialities" ></property>
<property name="companyProfile" column="company_profile" ></property>
<property name="moreInformation" column="more_information"></property>
<property name="yearfounded" column="year_founded" ></property>
<property name="keywords" column="key_words" ></property>
<property name="certificate" column="certificate" ></property>
<property name="travelStyleAsString" column="travel_style" ></property>
<property name="otherTravelStyle" column="other_travel_style" ></property>
</class>
_________________ Mahathi
|