How to map a search object to a class with more fields with JPA annotations

Posted by Moli on Stack Overflow See other posts from Stack Overflow or by Moli
Published on 2010-05-28T15:47:51Z Indexed on 2010/05/28 16:32 UTC
Read the original article Hit count: 183

Filed under:
|
|
|

Hi all,

I'm a newbie with JPA.

I need to map a search object to a table. The search object has only and id, name. The big object has more fileds id, name, adress and more.

I use this as big object view plaincopy to clipboardprint?

I use this as big object

@Entity
@Table(name="users")
public class User {

 @Id
 @GeneratedValue(strategy = GenerationType.AUTO)
 private long id;

 private String name;
 private String adress;
 private String keywords;
}

//this is my search object
@XXX
public class UserSearch {

 @Id
 @GeneratedValue(strategy = GenerationType.AUTO)
 private long id;

 private String name;

}

What annotations I need to use to map the search object to the table users?

I'm using spring+struts2+hibernate+JPA.

Help is appreciated! Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about spring