This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 225373 - template for JPA @Id proposal
Summary: template for JPA @Id proposal
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-26 20:35 UTC by ecerichter
Modified: 2016-07-07 07:26 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ecerichter 2013-01-26 20:35:40 UTC
Product Version = NetBeans IDE Dev (Build nbms-and-javadoc-10056-on-20130112)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_11
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.6-b04

I do propose to offer standard @Id template for tables. It's shorthand can be "idt", that will expand to

  @Id
  @GeneratedValue(strategy = GenerationType.TABLE, generator = "seq_${Type}")
  @TableGenerator(name = "seq_${Type}", table = "seq_table", pkColumnName = "seq_name", pkColumnValue = "seq_${Type}", valueColumnName = "seq_value", allocationSize = 1, initialValue = 0)


The sequences table used for the code above is:

create table seq_table (
  seq_name varchar(250) not null,
  seq_value integer not null default 0,
  constraint pk_seq_table primary key on (seq_name)
)

Similar templates can be offered for Identitity generation ("idi") and Sequence ("ids").
Comment 1 Martin Balin 2016-07-07 07:26:28 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss