I am new in hibernate.I tried some basic CRUD operations using hibernate API.
I created a class Person
@Entity
class Person
{
String name
}
I was able to save this class in Database. Till now I was thinking that JPA internally makes this class implement Serializable because only serialization can save the state of an object.But I tried this :
Person p=new Person();
boolean bool=p instanceof Serializable;
sop(bool); //false
Then I created another class Human (found this way of implementation on Hibernate doc)
@Entity
class Human implements Serializable
{
String name
}
Human h=new Human();
boolean bool=h instanceof Serializable
sop(bool); //true
Which way we should create our domain classes and how hibernate internally treats these two ways ?
Please help.