-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ids for this class must be manually assigned before calling
PostPosted: Thu Jan 15, 2009 1:30 am 
Beginner
Beginner

Joined: Thu Aug 17, 2006 12:44 pm
Posts: 22
Location: Ohio
I have a very simple scenario. Customers can have 1 to many logs. The main log key is an identity column. The log table has a customer_id.

Why would I be getting this error?



Code:
package org.domain.dillans.entity;

// Generated Jan 13, 2009 7:12:06 PM by Hibernate Tools 3.2.4.CR1

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
* CustomerLog generated by hbm2java
*/
@Entity
@Table(name = "customer_log")
public class CustomerLog implements java.io.Serializable {

   private Integer customerLogId;
   private Customer customer;
   private Date logDate;
   private String logText;

   public CustomerLog() {
   }

   public CustomerLog(Customer customer) {
      this.customer = customer;
   }

   public CustomerLog(Customer customer, Date logDate, String logText) {
      this.customer = customer;
      this.logDate = logDate;
      this.logText = logText;
   }

   @Id
   @GeneratedValue(strategy = IDENTITY)
   @Column(name = "customer_log_id", unique = true, nullable = false)
   public Integer getCustomerLogId() {
      return this.customerLogId;
   }

   public void setCustomerLogId(Integer customerLogId) {
      this.customerLogId = customerLogId;
   }

   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "customer_id", nullable = false)
   @NotNull
   public Customer getCustomer() {
      return this.customer;
   }

   public void setCustomer(Customer customer) {
      this.customer = customer;
   }

   @Temporal(TemporalType.TIMESTAMP)
   @Column(name = "log_date", length = 19)
   public Date getLogDate() {
      return this.logDate;
   }

   public void setLogDate(Date logDate) {
      this.logDate = logDate;
   }

   @Column(name = "log_text", length = 65535)
   @Length(max = 65535)
   public String getLogText() {
      return this.logText;
   }

   public void setLogText(String logText) {
      this.logText = logText;
   }

}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.