Hibernate version:Hibernate 3.2.0.cr2
Hibernate Annotations: 3.1 Beta 10
Hi,
I am using the bulk update feature of Hibernate to update my table. The code is as follows.
Code:
String hqlUpdate = "update versioned ProductModel pm set pm.active = :active where pm.relationServiceIdServiceModel.serviceId = :serviceId";
int updatedEntities = session.createQuery( hqlUpdate )
.setBoolean( "active", Boolean.FALSE )
.setLong( "serviceId", id )
.executeUpdate();
Everythingh is working fine and the actual update is happening as well in database. But hibernate is giving following Warning message in Log.
Code:
[iServ] WARN [http-8080-Processor9] FromElementType.toColumns(349) | Using non-qualified column reference [active -> ([IS_ACTIVE])]
[iServ] WARN [http-8080-Processor9] FromElementType.toColumns(349) | Using non-qualified column reference [relationServiceIdServiceModel -> ([SERVICE_ID])]
[iServ] WARN [http-8080-Processor9] FromElementType.toColumns(349) | Using non-qualified column reference [versionNo -> ([VERSION_NO])]
[iServ] WARN [http-8080-Processor9] FromElementType.toColumns(349) | Using non-qualified column reference [versionNo -> ([VERSION_NO])]
Hibernate: update PRODUCT set VERSION_NO=VERSION_NO+1, IS_ACTIVE=? where SERVICE_ID=?
I want to know that how to avoid this message as far as i know HQL queries are written in terms of properties as is the case with my code so how to avoid this warning. For refernce i am attaching POJO annotated code of my model as well (It is generated by JAG so it looks like generated as well :))
Code:
package com.inov8.iserv.common.model;
import java.util.*;
import javax.persistence.*;
import com.inov8.iserv.common.model.framework.*;
/**
* The ProductModel entity bean.
*
* @author Shoaib Akhtar Inov8 Limited
* @version $Revision: 1.6 $, $Date: 2006/04/10 14:25:28 $
*
*/
@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true)
@javax.persistence.SequenceGenerator(name = "PRODUCT_seq",
sequenceName = "PRODUCT_seq",
initialValue = 0)
@Table(name = "PRODUCT")
public class ProductModel
extends BasePersistableModel
{
private VendorModel vendorIdVendorModel;
private SupplierModel supplierIdSupplierModel;
private ServiceModel serviceIdServiceModel;
private AppUserModel createdByAppUserModel;
private AppUserModel updatedByAppUserModel;
private Collection<CommissionRateModel> productIdCommissionRateModelList = new
ArrayList<CommissionRateModel> ();
private Collection<DisConRetConTransactionModel>
productIdDisConRetConTransactionModelList = new ArrayList<
DisConRetConTransactionModel> ();
private Collection<ProductCatalogueDetailModel>
productIdProductCatalogueDetailModelList = new ArrayList<
ProductCatalogueDetailModel> ();
private Collection<ProductUnitModel> productIdProductUnitModelList = new
ArrayList<ProductUnitModel> ();
private Collection<SaleDetailModel> productIdSaleDetailModelList = new
ArrayList<SaleDetailModel> ();
private Collection<ShipmentModel> productIdShipmentModelList = new ArrayList<
ShipmentModel> ();
private Long productId;
private String name;
private Double creditAmount;
private Double unitPrice;
private Long minimumStockLevel;
private Boolean active;
private String instruction;
private String description;
private String comments;
private Date updatedOn;
private Date createdOn;
private Integer versionNo;
/**
* Default constructor.
*/
public ProductModel()
{
}
/**
* Value object constructor.
*/
public ProductModel(ProductModel value)
{
if (value != null)
{
setProductId(value.getProductId());
}
if (value != null)
{
setServiceId(value.getServiceId());
}
if (value != null)
{
setVendorId(value.getVendorId());
}
if (value != null)
{
setName(value.getName());
}
if (value != null)
{
setCreditAmount(value.getCreditAmount());
}
if (value != null)
{
setUnitPrice(value.getUnitPrice());
}
if (value != null)
{
setMinimumStockLevel(value.getMinimumStockLevel());
}
if (value != null)
{
setActive(value.getActive());
}
if (value != null)
{
setInstruction(value.getInstruction());
}
if (value != null)
{
setDescription(value.getDescription());
}
if (value != null)
{
setComments(value.getComments());
}
if (value != null)
{
setCreatedBy(value.getCreatedBy());
}
if (value != null)
{
setUpdatedBy(value.getUpdatedBy());
}
if (value != null)
{
setUpdatedOn(value.getUpdatedOn());
}
if (value != null)
{
setCreatedOn(value.getCreatedOn());
}
if (value != null)
{
setVersionNo(value.getVersionNo());
}
if (value != null)
{
setSupplierId(value.getSupplierId());
}
}
/**
* Return the primary key.
*
* @return Long with the primary key.
*/
@javax.persistence.Transient
public Long getPrimaryKey()
{
return getProductId();
}
/**
* Set the primary key.
*
* @param primaryKey the primary key
*/
@javax.persistence.Transient
public void setPrimaryKey(Long primaryKey)
{
setProductId(primaryKey);
}
/**
* Returns the value of the <code>productId</code> property.
*
*/
@Column(name = "PRODUCT_ID", nullable = false)
@Id @GeneratedValue(strategy = GenerationType.SEQUENCE,
generator = "PRODUCT_seq")
public Long getProductId()
{
return productId;
}
/**
* Sets the value of the <code>productId</code> property.
*
* @param productId the value for the <code>productId</code> property
*
*/
public void setProductId(Long productId)
{
this.productId = productId;
}
/**
* Returns the value of the <code>name</code> property.
*
*/
@Column(name = "NAME", nullable = false, length = 50)
public String getName()
{
return name;
}
/**
* Sets the value of the <code>name</code> property.
*
* @param name the value for the <code>name</code> property
*
* @spring.validator type="required"
* @spring.validator type="maxlength"
* @spring.validator-args arg1value="${var:maxlength}"
* @spring.validator-var name="maxlength" value="50"
*/
public void setName(String name)
{
this.name = name;
}
/**
* Returns the value of the <code>creditAmount</code> property.
*
*/
@Column(name = "CREDIT_AMOUNT")
public Double getCreditAmount()
{
return creditAmount;
}
/**
* Sets the value of the <code>creditAmount</code> property.
*
* @param creditAmount the value for the <code>creditAmount</code> property
*
* @spring.validator type="double"
*/
public void setCreditAmount(Double creditAmount)
{
this.creditAmount = creditAmount;
}
/**
* Returns the value of the <code>unitPrice</code> property.
*
*/
@Column(name = "UNIT_PRICE")
public Double getUnitPrice()
{
return unitPrice;
}
/**
* Sets the value of the <code>unitPrice</code> property.
*
* @param unitPrice the value for the <code>unitPrice</code> property
*
* @spring.validator type="double"
*/
public void setUnitPrice(Double unitPrice)
{
this.unitPrice = unitPrice;
}
/**
* Returns the value of the <code>minimumStockLevel</code> property.
*
*/
@Column(name = "MINIMUM_STOCK_LEVEL", nullable = false)
public Long getMinimumStockLevel()
{
return minimumStockLevel;
}
/**
* Sets the value of the <code>minimumStockLevel</code> property.
*
* @param minimumStockLevel the value for the <code>minimumStockLevel</code> property
*
* @spring.validator type="required"
* @spring.validator type="long"
*/
public void setMinimumStockLevel(Long minimumStockLevel)
{
this.minimumStockLevel = minimumStockLevel;
}
/**
* Returns the value of the <code>active</code> property.
*
*/
@Column(name = "IS_ACTIVE")
public Boolean getActive()
{
return active;
}
/**
* Sets the value of the <code>active</code> property.
*
* @param active the value for the <code>active</code> property
*
* @spring.validator type="boolean"
*/
public void setActive(Boolean active)
{
this.active = active;
}
/**
* Returns the value of the <code>instruction</code> property.
*
*/
@Column(name = "INSTRUCTION", length = 4000)
public String getInstruction()
{
return instruction;
}
/**
* Sets the value of the <code>instruction</code> property.
*
* @param instruction the value for the <code>instruction</code> property
*
* @spring.validator type="maxlength"
* @spring.validator-args arg1value="${var:maxlength}"
* @spring.validator-var name="maxlength" value="4000"
*/
public void setInstruction(String instruction)
{
this.instruction = instruction;
}
/**
* Returns the value of the <code>description</code> property.
*
*/
@Column(name = "DESCRIPTION", length = 255)
public String getDescription()
{
return description;
}
/**
* Sets the value of the <code>description</code> property.
*
* @param description the value for the <code>description</code> property
*
* @spring.validator type="maxlength"
* @spring.validator-args arg1value="${var:maxlength}"
* @spring.validator-var name="maxlength" value="255"
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* Returns the value of the <code>comments</code> property.
*
*/
@Column(name = "COMMENTS", length = 255)
public String getComments()
{
return comments;
}
/**
* Sets the value of the <code>comments</code> property.
*
* @param comments the value for the <code>comments</code> property
*
* @spring.validator type="maxlength"
* @spring.validator-args arg1value="${var:maxlength}"
* @spring.validator-var name="maxlength" value="255"
*/
public void setComments(String comments)
{
this.comments = comments;
}
/**
* Returns the value of the <code>updatedOn</code> property.
*
*/
@Column(name = "UPDATED_ON")
public Date getUpdatedOn()
{
return updatedOn;
}
/**
* Sets the value of the <code>updatedOn</code> property.
*
* @param updatedOn the value for the <code>updatedOn</code> property
*
*/
public void setUpdatedOn(Date updatedOn)
{
this.updatedOn = updatedOn;
}
/**
* Returns the value of the <code>createdOn</code> property.
*
*/
@Column(name = "CREATED_ON")
public Date getCreatedOn()
{
return createdOn;
}
/**
* Sets the value of the <code>createdOn</code> property.
*
* @param createdOn the value for the <code>createdOn</code> property
*
*/
public void setCreatedOn(Date createdOn)
{
this.createdOn = createdOn;
}
/**
* Returns the value of the <code>versionNo</code> property.
*
*/
@Version
@Column(name = "VERSION_NO")
public Integer getVersionNo()
{
return versionNo;
}
/**
* Sets the value of the <code>versionNo</code> property.
*
* @param versionNo the value for the <code>versionNo</code> property
*
*/
public void setVersionNo(Integer versionNo)
{
this.versionNo = versionNo;
}
/**
* Returns the value of the <code>vendorIdVendorModel</code> relation property.
*
* @return the value of the <code>vendorIdVendorModel</code> relation property.
*
*/
@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@JoinColumn(name = "VENDOR_ID")
public VendorModel getRelationVendorIdVendorModel()
{
return vendorIdVendorModel;
}
/**
* Returns the value of the <code>vendorIdVendorModel</code> relation property.
*
* @return the value of the <code>vendorIdVendorModel</code> relation property.
*
*/
@javax.persistence.Transient
public VendorModel getVendorIdVendorModel()
{
return getRelationVendorIdVendorModel();
}
/**
* Sets the value of the <code>vendorIdVendorModel</code> relation property.
*
* @param vendorModel a value for <code>vendorIdVendorModel</code>.
*/
@javax.persistence.Transient
public void setRelationVendorIdVendorModel(VendorModel vendorModel)
{
this.vendorIdVendorModel = vendorModel;
}
/**
* Sets the value of the <code>vendorIdVendorModel</code> relation property.
*
* @param vendorModel a value for <code>vendorIdVendorModel</code>.
*/
@javax.persistence.Transient
public void setVendorIdVendorModel(VendorModel vendorModel)
{
setRelationVendorIdVendorModel(new VendorModel(vendorModel));
}
/**
* Returns the value of the <code>supplierIdSupplierModel</code> relation property.
*
* @return the value of the <code>supplierIdSupplierModel</code> relation property.
*
*/
@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@JoinColumn(name = "SUPPLIER_ID")
public SupplierModel getRelationSupplierIdSupplierModel()
{
return supplierIdSupplierModel;
}
/**
* Returns the value of the <code>supplierIdSupplierModel</code> relation property.
*
* @return the value of the <code>supplierIdSupplierModel</code> relation property.
*
*/
@javax.persistence.Transient
public SupplierModel getSupplierIdSupplierModel()
{
return getRelationSupplierIdSupplierModel();
}
/**
* Sets the value of the <code>supplierIdSupplierModel</code> relation property.
*
* @param supplierModel a value for <code>supplierIdSupplierModel</code>.
*/
@javax.persistence.Transient
public void setRelationSupplierIdSupplierModel(SupplierModel
supplierModel)
{
this.supplierIdSupplierModel = supplierModel;
}
/**
* Sets the value of the <code>supplierIdSupplierModel</code> relation property.
*
* @param supplierModel a value for <code>supplierIdSupplierModel</code>.
*/
@javax.persistence.Transient
public void setSupplierIdSupplierModel(SupplierModel supplierModel)
{
setRelationSupplierIdSupplierModel(new SupplierModel(supplierModel));
}
/**
* Returns the value of the <code>serviceIdServiceModel</code> relation property.
*
* @return the value of the <code>serviceIdServiceModel</code> relation property.
*
*/
@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@JoinColumn(name = "SERVICE_ID")
public ServiceModel getRelationServiceIdServiceModel()
{
return serviceIdServiceModel;
}
/**
* Returns the value of the <code>serviceIdServiceModel</code> relation property.
*
* @return the value of the <code>serviceIdServiceModel</code> relation property.
*
*/
@javax.persistence.Transient
public ServiceModel getServiceIdServiceModel()
{
return getRelationServiceIdServiceModel();
}
/**
* Sets the value of the <code>serviceIdServiceModel</code> relation property.
*
* @param serviceModel a value for <code>serviceIdServiceModel</code>.
*/
@javax.persistence.Transient
public void setRelationServiceIdServiceModel(ServiceModel serviceModel)
{
this.serviceIdServiceModel = serviceModel;
}
/**
* Sets the value of the <code>serviceIdServiceModel</code> relation property.
*
* @param serviceModel a value for <code>serviceIdServiceModel</code>.
*/
@javax.persistence.Transient
public void setServiceIdServiceModel(ServiceModel serviceModel)
{
setRelationServiceIdServiceModel(new ServiceModel(serviceModel));
}
/**
* Returns the value of the <code>createdByAppUserModel</code> relation property.
*
* @return the value of the <code>createdByAppUserModel</code> relation property.
*
*/
@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@JoinColumn(name = "CREATED_BY")
public AppUserModel getRelationCreatedByAppUserModel()
{
return createdByAppUserModel;
}
/**
* Returns the value of the <code>createdByAppUserModel</code> relation property.
*
* @return the value of the <code>createdByAppUserModel</code> relation property.
*
*/
@javax.persistence.Transient
public AppUserModel getCreatedByAppUserModel()
{
return getRelationCreatedByAppUserModel();
}
/**
* Sets the value of the <code>createdByAppUserModel</code> relation property.
*
* @param appUserModel a value for <code>createdByAppUserModel</code>.
*/
@javax.persistence.Transient
public void setRelationCreatedByAppUserModel(AppUserModel appUserModel)
{
this.createdByAppUserModel = appUserModel;
}
/**
* Sets the value of the <code>createdByAppUserModel</code> relation property.
*
* @param appUserModel a value for <code>createdByAppUserModel</code>.
*/
@javax.persistence.Transient
public void setCreatedByAppUserModel(AppUserModel appUserModel)
{
setRelationCreatedByAppUserModel(new AppUserModel(appUserModel));
}
/**
* Returns the value of the <code>updatedByAppUserModel</code> relation property.
*
* @return the value of the <code>updatedByAppUserModel</code> relation property.
*
*/
@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@JoinColumn(name = "UPDATED_BY")
public AppUserModel getRelationUpdatedByAppUserModel()
{
return updatedByAppUserModel;
}
/**
* Returns the value of the <code>updatedByAppUserModel</code> relation property.
*
* @return the value of the <code>updatedByAppUserModel</code> relation property.
*
*/
@javax.persistence.Transient
public AppUserModel getUpdatedByAppUserModel()
{
return getRelationUpdatedByAppUserModel();
}
/**
* Sets the value of the <code>updatedByAppUserModel</code> relation property.
*
* @param appUserModel a value for <code>updatedByAppUserModel</code>.
*/
@javax.persistence.Transient
public void setRelationUpdatedByAppUserModel(AppUserModel appUserModel)
{
this.updatedByAppUserModel = appUserModel;
}
/**
* Sets the value of the <code>updatedByAppUserModel</code> relation property.
*
* @param appUserModel a value for <code>updatedByAppUserModel</code>.
*/
@javax.persistence.Transient
public void setUpdatedByAppUserModel(AppUserModel appUserModel)
{
setRelationUpdatedByAppUserModel(new AppUserModel(appUserModel));
}
/**
* Add the related CommissionRateModel to this one-to-many relation.
*
* @param commissionRateModel object to be added.
*/
public void addProductIdCommissionRateModel(CommissionRateModel
commissionRateModel)
{
commissionRateModel.setRelationProductIdProductModel(this);
productIdCommissionRateModelList.add(commissionRateModel);
}
/**
* Get a list of related CommissionRateModel objects of the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @return Collection of CommissionRateModel objects.
*
*/
@OneToMany(cascade =
{
CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH},
fetch = FetchType.LAZY, mappedBy = "relationProductIdProductModel")
@JoinColumn(name = "PRODUCT_ID")
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.
SAVE_UPDATE,
org.hibernate.annotations.CascadeType.
PERSIST,
org.hibernate.annotations.CascadeType.
MERGE,
org.hibernate.annotations.CascadeType.
REFRESH})
public Collection<CommissionRateModel>
getProductIdCommissionRateModelList() throws Exception
{
return productIdCommissionRateModelList;
}
/**
* Set a list of CommissionRateModel related objects to the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @param commissionRateModelList the list of related objects.
*/
public void setProductIdCommissionRateModelList(Collection<
CommissionRateModel>
commissionRateModelList) throws Exception
{
this.productIdCommissionRateModelList = commissionRateModelList;
}
/**
* Add the related DisConRetConTransactionModel to this one-to-many relation.
*
* @param disConRetConTransactionModel object to be added.
*/
public void addProductIdDisConRetConTransactionModel(
DisConRetConTransactionModel disConRetConTransactionModel)
{
disConRetConTransactionModel.setRelationProductIdProductModel(this);
productIdDisConRetConTransactionModelList.add(disConRetConTransactionModel);
}
/**
* Get a list of related DisConRetConTransactionModel objects of the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @return Collection of DisConRetConTransactionModel objects.
*
*/
@OneToMany(cascade =
{
CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH},
fetch = FetchType.LAZY, mappedBy = "relationProductIdProductModel")
@JoinColumn(name = "PRODUCT_ID")
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.
SAVE_UPDATE,
org.hibernate.annotations.CascadeType.
PERSIST,
org.hibernate.annotations.CascadeType.
MERGE,
org.hibernate.annotations.CascadeType.
REFRESH})
public Collection<DisConRetConTransactionModel>
getProductIdDisConRetConTransactionModelList() throws Exception
{
return productIdDisConRetConTransactionModelList;
}
/**
* Set a list of DisConRetConTransactionModel related objects to the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @param disConRetConTransactionModelList the list of related objects.
*/
public void setProductIdDisConRetConTransactionModelList(Collection<
DisConRetConTransactionModel> disConRetConTransactionModelList) throws
Exception
{
this.productIdDisConRetConTransactionModelList =
disConRetConTransactionModelList;
}
/**
* Add the related ProductCatalogueDetailModel to this one-to-many relation.
*
* @param productCatalogueDetailModel object to be added.
*/
public void addProductIdProductCatalogueDetailModel(
ProductCatalogueDetailModel productCatalogueDetailModel)
{
productCatalogueDetailModel.setRelationProductIdProductModel(this);
productIdProductCatalogueDetailModelList.add(productCatalogueDetailModel);
}
/**
* Get a list of related ProductCatalogueDetailModel objects of the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @return Collection of ProductCatalogueDetailModel objects.
*
*/
@OneToMany(cascade =
{
CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH},
fetch = FetchType.LAZY, mappedBy = "relationProductIdProductModel")
@JoinColumn(name = "PRODUCT_ID")
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.
SAVE_UPDATE,
org.hibernate.annotations.CascadeType.
PERSIST,
org.hibernate.annotations.CascadeType.
MERGE,
org.hibernate.annotations.CascadeType.
REFRESH})
public Collection<ProductCatalogueDetailModel>
getProductIdProductCatalogueDetailModelList() throws Exception
{
return productIdProductCatalogueDetailModelList;
}
/**
* Set a list of ProductCatalogueDetailModel related objects to the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @param productCatalogueDetailModelList the list of related objects.
*/
public void setProductIdProductCatalogueDetailModelList(Collection<
ProductCatalogueDetailModel> productCatalogueDetailModelList) throws
Exception
{
this.productIdProductCatalogueDetailModelList =
productCatalogueDetailModelList;
}
/**
* Add the related ProductUnitModel to this one-to-many relation.
*
* @param productUnitModel object to be added.
*/
public void addProductIdProductUnitModel(ProductUnitModel productUnitModel)
{
productUnitModel.setRelationProductIdProductModel(this);
productIdProductUnitModelList.add(productUnitModel);
}
/**
* Get a list of related ProductUnitModel objects of the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @return Collection of ProductUnitModel objects.
*
*/
@OneToMany(cascade =
{
CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH},
fetch = FetchType.LAZY, mappedBy = "relationProductIdProductModel")
@JoinColumn(name = "PRODUCT_ID")
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.
SAVE_UPDATE,
org.hibernate.annotations.CascadeType.
PERSIST,
org.hibernate.annotations.CascadeType.
MERGE,
org.hibernate.annotations.CascadeType.
REFRESH})
public Collection<ProductUnitModel> getProductIdProductUnitModelList() throws
Exception
{
return productIdProductUnitModelList;
}
/**
* Set a list of ProductUnitModel related objects to the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @param productUnitModelList the list of related objects.
*/
public void setProductIdProductUnitModelList(Collection<ProductUnitModel>
productUnitModelList) throws Exception
{
this.productIdProductUnitModelList = productUnitModelList;
}
/**
* Add the related SaleDetailModel to this one-to-many relation.
*
* @param saleDetailModel object to be added.
*/
public void addProductIdSaleDetailModel(SaleDetailModel saleDetailModel)
{
saleDetailModel.setRelationProductIdProductModel(this);
productIdSaleDetailModelList.add(saleDetailModel);
}
/**
* Get a list of related SaleDetailModel objects of the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @return Collection of SaleDetailModel objects.
*
*/
@OneToMany(cascade =
{
CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH},
fetch = FetchType.LAZY, mappedBy = "relationProductIdProductModel")
@JoinColumn(name = "PRODUCT_ID")
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.
SAVE_UPDATE,
org.hibernate.annotations.CascadeType.
PERSIST,
org.hibernate.annotations.CascadeType.
MERGE,
org.hibernate.annotations.CascadeType.
REFRESH})
public Collection<SaleDetailModel> getProductIdSaleDetailModelList() throws
Exception
{
return productIdSaleDetailModelList;
}
/**
* Set a list of SaleDetailModel related objects to the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @param saleDetailModelList the list of related objects.
*/
public void setProductIdSaleDetailModelList(Collection<SaleDetailModel>
saleDetailModelList) throws Exception
{
this.productIdSaleDetailModelList = saleDetailModelList;
}
/**
* Add the related ShipmentModel to this one-to-many relation.
*
* @param shipmentModel object to be added.
*/
public void addProductIdShipmentModel(ShipmentModel shipmentModel)
{
shipmentModel.setRelationProductIdProductModel(this);
productIdShipmentModelList.add(shipmentModel);
}
/**
* Get a list of related ShipmentModel objects of the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @return Collection of ShipmentModel objects.
*
*/
@OneToMany(cascade =
{
CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH},
fetch = FetchType.LAZY, mappedBy = "relationProductIdProductModel")
@JoinColumn(name = "PRODUCT_ID")
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.
SAVE_UPDATE,
org.hibernate.annotations.CascadeType.
PERSIST,
org.hibernate.annotations.CascadeType.
MERGE,
org.hibernate.annotations.CascadeType.
REFRESH})
public Collection<ShipmentModel> getProductIdShipmentModelList() throws
Exception
{
return productIdShipmentModelList;
}
/**
* Set a list of ShipmentModel related objects to the ProductModel object.
* These objects are in a bidirectional one-to-many relation by the ProductId member.
*
* @param shipmentModelList the list of related objects.
*/
public void setProductIdShipmentModelList(Collection<ShipmentModel>
shipmentModelList) throws Exception
{
this.productIdShipmentModelList = shipmentModelList;
}
/**
* Returns the value of the <code>vendorId</code> property.
*
*/
@javax.persistence.Transient
public Long getVendorId()
{
if (vendorIdVendorModel != null)
{
return vendorIdVendorModel.getVendorId();
}
else
{
return null;
}
}
/**
* Sets the value of the <code>vendorId</code> property.
*
* @param vendorId the value for the <code>vendorId</code> property
*/
@javax.persistence.Transient
public void setVendorId(Long vendorId)
{
if (vendorIdVendorModel == null)
{
vendorIdVendorModel = new VendorModel();
}
vendorIdVendorModel.setVendorId(vendorId);
}
/**
* Returns the value of the <code>supplierId</code> property.
*
*/
@javax.persistence.Transient
public Long getSupplierId()
{
if (supplierIdSupplierModel != null)
{
return supplierIdSupplierModel.getSupplierId();
}
else
{
return null;
}
}
/**
* Sets the value of the <code>supplierId</code> property.
*
* @param supplierId the value for the <code>supplierId</code> property
*/
@javax.persistence.Transient
public void setSupplierId(Long supplierId)
{
if (supplierIdSupplierModel == null)
{
supplierIdSupplierModel = new SupplierModel();
}
supplierIdSupplierModel.setSupplierId(supplierId);
}
/**
* Returns the value of the <code>serviceId</code> property.
*
*/
@javax.persistence.Transient
public Long getServiceId()
{
if (serviceIdServiceModel != null)
{
return serviceIdServiceModel.getServiceId();
}
else
{
return null;
}
}
/**
* Sets the value of the <code>serviceId</code> property.
*
* @param serviceId the value for the <code>serviceId</code> property
*/
@javax.persistence.Transient
public void setServiceId(Long serviceId)
{
if (serviceIdServiceModel == null)
{
serviceIdServiceModel = new ServiceModel();
}
serviceIdServiceModel.setServiceId(serviceId);
}
/**
* Returns the value of the <code>appUserId</code> property.
*
*/
@javax.persistence.Transient
public Long getCreatedBy()
{
if (createdByAppUserModel != null)
{
return createdByAppUserModel.getAppUserId();
}
else
{
return null;
}
}
/**
* Sets the value of the <code>appUserId</code> property.
*
* @param appUserId the value for the <code>appUserId</code> property
*/
@javax.persistence.Transient
public void setCreatedBy(Long appUserId)
{
if (createdByAppUserModel == null)
{
createdByAppUserModel = new AppUserModel();
}
createdByAppUserModel.setAppUserId(appUserId);
}
/**
* Returns the value of the <code>appUserId</code> property.
*
*/
@javax.persistence.Transient
public Long getUpdatedBy()
{
if (updatedByAppUserModel != null)
{
return updatedByAppUserModel.getAppUserId();
}
else
{
return null;
}
}
/**
* Sets the value of the <code>appUserId</code> property.
*
* @param appUserId the value for the <code>appUserId</code> property
*/
@javax.persistence.Transient
public void setUpdatedBy(Long appUserId)
{
if (updatedByAppUserModel == null)
{
updatedByAppUserModel = new AppUserModel();
}
updatedByAppUserModel.setAppUserId(appUserId);
}
/**
* Used by the display tag library for rendering a checkbox in the list.
* @return String with a HTML checkbox.
*/
@Transient
public String getCheckbox()
{
String checkBox = "<input type=\"checkbox\" name=\"checkbox";
checkBox += "_" + getProductId();
checkBox += "\"/>";
return checkBox;
}
/**
* Helper method for Struts with displaytag
*/
@javax.persistence.Transient
public String getPrimaryKeyParameters()
{
String parameters = "";
parameters += "&productId=" + getProductId();
return parameters;
}
/**
* Helper method for default Sorting on Primary Keys
*/
@javax.persistence.Transient
public String[] getPrimaryKeysFieldName()
{
ArrayList<String> pkFieldNameList = new ArrayList<String> ();
pkFieldNameList.add("productId");
String[] pkFieldNameArray = new String[pkFieldNameList.size()];
return (String[]) pkFieldNameList.toArray(pkFieldNameArray);
}
}
Please help me asap.
Regards,
Shoaib Akhtar