Lambico entity with Oracle DB

3 views
Skip to first unread message

Enrico Giurin

unread,
Mar 28, 2012, 5:27:37 AM3/28/12
to lambico-users
I was wondering how to use lambico with Oracle, in which I need to use
sequences for Id primary key. Without specify the sequence in the jpa
entity, I see that hibernate creates a shared sequence for all the
tables. Actually I'd like to have a sequence for each table.
I tried to specify the sequence definition in my entity extending
EntityBase but with no effect, still I see a unique shared sequence,
hibernate_sequence.
Any idea about how to deal with this?
Thanks.

Lucio Benfante

unread,
Mar 28, 2012, 11:37:26 PM3/28/12
to lambic...@googlegroups.com

Hi Enrico,
this should work:

@Entity
@Table(name = "USER_PROFILE")
public class UserProfile extends EntityBase {

private Long id;

public UserProfile(){

}

@Id
@SequenceGenerator(name = "user_prof_seq", sequenceName =
"SEQ_USER_PROF", initialValue=1, allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE,
generator="user_prof_seq")
@Column(name="ID")
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

...
}

--
Lucio Benfante http://www.lambico.org
JUG Padova http://www.parancoe.org
www.jugpadova.it http://www.jugevents.org

Reply all
Reply to author
Forward
0 new messages