[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Unable to update record

suneetshah2000 do-not-reply at jboss.com
Mon Apr 2 15:17:07 EDT 2007


hello, 

I have a persistent object that I generated using the Hibernate tools eclipse. I am able to insert a record, but I am not able to update a record. When I call that method, it always seems to issue in insert.

Any ideas would be greatly appreciated.

DAO Code ---

   @Transactional( propagation = Propagation.REQUIRED, readOnly = false )
  | 	public void persist(Service transientInstance) {
  | 		log.debug("persisting Service instance");
  | 		try {
  | 			entityManager.persist(transientInstance);
  | 			log.debug("persist successful");
  | 		} catch (RuntimeException re) {
  | 			re.printStackTrace();
  | 			log.error("persist failed", re);
  | 			throw re;
  | 		}
  | 	}
  | 

Object ----


  | @Entity
  | @Table(name = "service",  uniqueConstraints = {})
  | public class Service implements java.io.Serializable {
  | 
  | 	// Fields    
  | 
  | 	private String serviceId;
  | 
  | 	private String serviceName;
  | 
  | 	private String status;
  | 
  | 	private String locationIpAddress;
  | 
  | 	private String companyOwnerId;
  | 
  | 	private Date startDate;
  | 
  | 	private Date endDate;
  | 
  | 	private String licenseKey;
  | 
  | 	private String serviceType;
  | 
  | 	private String parentServiceId;
  | 
  | 	private String rootResourceId;
  | 
  | 	private String accessControlModel;
  | 
  | 	private String param1;
  | 
  | 	private String param2;
  | 
  | 	private String param3;
  | 
  | 	private String param4;
  | 
  | 	private String param5;
  | 
  | 	private Set<RequestApprover> requestApprovers = new HashSet<RequestApprover>(0);
  | 
  | 	private Set<ServiceConfig> serviceConfigs = new HashSet<ServiceConfig>(0);
  | 
  | 	private Set<RequestForm> requestForms = new HashSet<RequestForm>(0);
  | 
  | 	// Constructors
  | 
  | 	/** default constructor */
  | 	public Service() {
  | 	}
  | 
  | 	/** minimal constructor */
  | 	public Service(String serviceId) {
  | 		this.serviceId = serviceId;
  | 	}
  | 
  | 	/** full constructor */
  | 	public Service(String serviceId, String serviceName, String status,
  | 			String locationIpAddress, String companyOwnerId, Date startDate,
  | 			Date endDate, String licenseKey, String serviceType,
  | 			String parentServiceId, String rootResourceId,
  | 			String accessControlModel, String param1, String param2,
  | 			String param3, String param4, String param5,
  | 			Set<RequestApprover> requestApprovers,
  | 			Set<ServiceConfig> serviceConfigs, Set<RequestForm> requestForms) {
  | 		this.serviceId = serviceId;
  | 		this.serviceName = serviceName;
  | 		this.status = status;
  | 		this.locationIpAddress = locationIpAddress;
  | 		this.companyOwnerId = companyOwnerId;
  | 		this.startDate = startDate;
  | 		this.endDate = endDate;
  | 		this.licenseKey = licenseKey;
  | 		this.serviceType = serviceType;
  | 		this.parentServiceId = parentServiceId;
  | 		this.rootResourceId = rootResourceId;
  | 		this.accessControlModel = accessControlModel;
  | 		this.param1 = param1;
  | 		this.param2 = param2;
  | 		this.param3 = param3;
  | 		this.param4 = param4;
  | 		this.param5 = param5;
  | 		this.requestApprovers = requestApprovers;
  | 		this.serviceConfigs = serviceConfigs;
  | 		this.requestForms = requestForms;
  | 	}
  | 
  | 	// Property accessors
  | 	@Id
  | 	@Column(name = "SERVICE_ID", unique = true, nullable = false, insertable = true, updatable = true, length = 20)
  | 	public String getServiceId() {
  | 		return this.serviceId;
  | 	}
  | 
  | 	public void setServiceId(String serviceId) {
  | 		this.serviceId = serviceId;
  | 	}
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033799#4033799

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033799



More information about the jboss-user mailing list