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.  [ 4 posts ] 
Author Message
 Post subject: Could not determine type - exception
PostPosted: Fri Jan 02, 2009 7:49 am 
Newbie

Joined: Fri Jan 02, 2009 7:40 am
Posts: 3
hi all!
i'm pretty new to java ee and i'm stuck on my 3rd program. i'm coding a library application. so there is 2 classes, books and persons.
however they are kept really simple, nontheless i get an error and can't figure out a solution:

error:
12:38:53,682 WARN [ServiceController] Problem starting service persistence.units:jar=a0326045_ASE_BSP2.jar,unitName=ASEDB
org.hibernate.MappingException: Could not determine type for: entity.server.Person, for columns: [org.hibernate.mapping.Column(PERSON)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
.
.
.

person.class:
Code:
package entity.server;


import javax.persistence.*;

@Entity
@Table(name="person")
@NamedQueries(value={
   @NamedQuery(name= "Person.byName", query = "select p from Person p where name = :name order by p.name"),
   @NamedQuery(name= "Person.allPersons", query = "select p from Person p order by p.name"),
   @NamedQuery(name= "Person.byId", query = "select p from Person p where p.personId = :personId")
})

public class Person {
   
   @Id
   @Column(name="PERSONID")
   private int personId;
   public int getId(){return this.personId;}
   public void setId(int personId){this.personId = personId;}
   
   @Column(name="NAME")
   private String name;
   public String getName() {return name;}
   public void setName(String newName) {this.name = newName;}
   
   @Column(name="MAXBOOKS")
   private int maximumBooks;
   public int getMaximumBooks() {return maximumBooks;}
   public void setMaximumBooks(int maximumBooks) {this.maximumBooks = maximumBooks;}



i haven't even called the entitybean in my session bean.

i would be more then thankful for any advice or idea,

thanks in advance
flokki


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 02, 2009 9:41 am 
Beginner
Beginner

Joined: Wed Nov 26, 2008 1:02 am
Posts: 22
hi,

Every non static non transient property (field or method) of an entity bean is considered persistent, unless you annotate it as @Transient.

so use @transient for property PERSON

regards,

_________________
if it solves,rate me


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 02, 2009 9:49 am 
Newbie

Joined: Fri Jan 02, 2009 7:40 am
Posts: 3
thanks fpr the quick reply...even though i have to admit that i don't clearly understand it. @transient sets the nonpersistent right? so if i declare something @transient it is not saved to the database right?

why would i like to do that?

thanks,
flokki


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 02, 2009 12:03 pm 
Newbie

Joined: Fri Jan 02, 2009 7:40 am
Posts: 3
...found the error. it was located in another class... :( sorry for consuming your time.
the question that i have now is even more basic. are the tables in the remote database supposed to be created manually or does the bean take care of it? i thought the tables are created by the annotations, obviously my tables are not being created automaticly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.