Nicolas Bihan [
https://community.jboss.org/people/nicotexas] created the discussion
"Hibernate Tools 4 Alpha @SequenceGenerator unique name ?"
To view the discussion, visit:
https://community.jboss.org/message/760078#760078
--------------------------------------------------------------
Hi, I'm trying to get hbm2java (Eclipse tools 4) to generate my entities with EJB3
annotations to get the @GeneratedValue and @SequenceGenerator for my primary keys. Right
now when generating my POJOs I get @SequenceGenerator(name = "generator",
sequenceName = "S_CLIENT") @Id @GeneratedValue(strategy = SEQUENCE,
generator = "generator") @Column(name = "CLIENT_ID", unique = true,
nullable = false, precision = 22, scale = 0) public long getClientId() { return
this.clientId; } Look OK but the problem is generator = "generator" that
will be the same for every POJO hbm2java generates. I can't find any way to set the
name for the SequenceGenerator. Tried with reveng.xml
S_CLIENT true true and
DelegatingReverseEngineeringStrategy @Override public Properties
getTableIdentifierProperties(TableIdentifier identifier) {
//@SequenceGenerator(name="APP_DEVDB_APPDEVDBID_GENERATOR",
sequenceName="S_APP_DEVDB") Properties properties = new
Properties(); properties.put("sequence",
"S_"+identifier.getName());
properties.put("name", "Generator"+identifier.getName()); return
properties; } public String getTableIdentifierStrategyName(TableIdentifier
identifier) { return "sequence"; } Any way to change that
behavior? Thanks....
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/760078#760078]
Start a new discussion in JBoss Tools at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]