-->
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.  [ 2 posts ] 
Author Message
 Post subject: Need help with an Esay Hibernate Question!
PostPosted: Sat Jun 20, 2009 10:49 am 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
Hi,

I have an easy hibernate question. I am getting the following error:
Code:
org.hibernate.MappingException: Could not determine type for: Long, at table: PERSON, for columns: [org.hibernate.mapping.Column(ID)]

I am using annotations only for my application; so I have no hbm.xml files. Is there a way to specify the mapping type in the Column annotation? Is my only option is to use a hbm.xml file to specify this?

BTW, my annotated class looks like this:
Code:
package com.aviall.edi.jedi.persistence.commons.vo.hibernate;

import static javax.persistence.GenerationType.SEQUENCE;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.aviall.commons.vo.model.api.IEmailAddressVO;
import com.aviall.commons.vo.model.api.IPersonVO;
import com.aviall.edi.jedi.persistence.commons.models.BaseEntityModel;

@javax.persistence.Entity
//@AttributeOverride(name = "id", column = @Column(name = "ID", nullable=false, updatable=false, insertable=false))
@Table(name = "PERSON")
@NamedQueries( {
      @NamedQuery(name = "PersonHibernateVO.findByFirstName", query = "select p from PersonHibernateVO p where p.firstName = ?"),
      @NamedQuery(name = "PersonHibernateVO.findByLastName", query = "select p from PersonHibernateVO p where p.lastName = ?") })
public class PersonHibernateVO extends BaseEntityModel implements IPersonVO {
   private static final long serialVersionUID = 1L;
   @SequenceGenerator(name="generator", sequenceName="PERSON_SEQ")
   @Id @GeneratedValue(strategy=SEQUENCE, generator="generator")
   @Column(name="ID", unique=true, nullable=false, updatable=false, insertable=false)
   private Long id;
   @Column(name = "FIRST_NAME", nullable = false, length = 100)
   private String firstName;
   @Column(name = "MIDDLE_NAME", nullable = false, length = 100)
   private String middleName;
   @Column(name = "LAST_NAME", nullable = false, length = 100)
   private String lastName;

   @org.hibernate.annotations.CollectionOfElements(
      targetElement = com.aviall.edi.jedi.persistence.commons.vo.hibernate.EmailAddressHibernateVO.class
   )
   @JoinTable(name = "PERSON_EMAIL_ADDRESS", joinColumns = @JoinColumn(name = "PERSON_ID"))
   private Set<IEmailAddressVO> emailAddresses = new HashSet<IEmailAddressVO>();

   @SuppressWarnings("unused")
   public PersonHibernateVO(){}
   
   public PersonHibernateVO(String firstName, String middleName,
         String lastName, Set<IEmailAddressVO> emailAddresses,
         String createdBy, Date createdDate, String updatedBy,
         Date updatedDate) {
      super(createdBy, createdDate, updatedBy, updatedDate);
      this.firstName = firstName;
      this.middleName = middleName;
      this.lastName = lastName;
      this.emailAddresses = emailAddresses;
   }
   
   
   public Long getId(){
      return id;
   }
   
   public void setId(Long id){
      this.id = id;
   }

   @Override
   public String getFirstName() {
      return firstName;
   }

   @Override
   public String getLastName() {
      return lastName;
   }

   @Override
   public String getMiddleName() {
      return middleName;
   }

   @Override
   public void setFirstName(String firstName) {
      this.firstName = firstName;
   }

   @Override
   public void setLastName(String lastName) {
      this.lastName = lastName;
   }

   @Override
   public void setMiddleName(String middleName) {
      this.middleName = middleName;
   }

   @Override
   public Set<IEmailAddressVO> getEmailAddresses() {
      return emailAddresses;
   }

   @Override
   public void setEmailAddresses(Set<IEmailAddressVO> emailAddresses) {
      this.emailAddresses = emailAddresses;

   }
}



Thanks!

_________________
pouncilt


Top
 Profile  
 
 Post subject: Re: Need help with an Esay Hibernate Question!
PostPosted: Mon Jun 22, 2009 4:32 pm 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
I figured out what I was doing wrong. Thanks!

_________________
pouncilt


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

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.