Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Persistence: generating a value automatically

Status
Not open for further replies.

McBugzz

Programmer
Sep 17, 2002
90
0
0
JP
Hi,

I have a bean:

class SomeBean {
private long number;

//... getter/setter
}

I need to assign a value to to SomeBean.number automatically, when it's persisted with the EntityManager.

Are there any annotations that would do the job? GeneratedValue didn't help, as much as I tried. Note that SomeBean.number is not an id. It's just a field which I need to automatically initialize with a value (actually, a global, unique id, such that two same values wouldn't exist even in different database tables).

Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top