Enlightensoft's Blog

Helping in your each step

  • Categories

  • Authors

How to use sequence in ID tag of hbm.xml???

Posted by Pankil Patel on September 26, 2011

How to use sequence in ID tag of hbm.xml???

<id name=“id” type=“java.lang.Long” column=“ID”>

<generatorclass=“sequence”><paramname=“sequence”>XYZ_TAG_STAFF_SEQ</param></generator>

</id>

OR

@Id @GeneratedValue(generator=”sequence”)
@GenericGenerator(name=”sequence”, strategy = “sequence”,
parameters = {
@Parameter(name=”sequence”, value=”XYZ_TAG_STAFF_SEQ”)
}
)
public Integer getID() {
return ID;
}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: