cancel
Showing results for 
Search instead for 
Did you mean: 

How to provide auto increment property to database table via defining trigger ?

Hi,

I want to add auto increment property to database table. How can I do it with trigger ? I tried to alter my primary key with this method generated by default as IDENTITY but it didn't work.

pfefferf
Active Contributor
0 Kudos

What error message do you get when doing the alter?

And why you wanna do that with a trigger?

Hi Florian,

The reason of error message is related with column type. I read this blog and I saw HANA does not supports generated by default as identity for row columns. I wanted to create my tables on HANA by using JPA-EclipseLink and JPA creates tables as row store type. I could not find any way to support column store type in JPA properties.

Except those, there are another problems between HANA and Eclipselink integration like foreign key constraints, auto increment, table generation. So I decided to give up the JPA until HANA and Eclipselink supports the problems.

As a result, I searched another ways to support auto increment for my table. The first one is trigger, I wanted to support auto increment property by using a trigger, when someone tried to post data to my service in front-end the trigger is going to generate the automatically ID of the database table. But there is a problem while I'm defining CREATE TRIGGER sql command. Even if I define the trigger correctly, I'm getting errors like begin expected found... or end expected found. I did not understand why I'm getting these errors.

The second way, I tried to support ID generation in my xs service. I found this blog for my purpose. I defined my database tables with using .hdbdd file. While defining tables I used association between entities but it did not work. I do some research and could not find a true definition.

As a conclusion, I wonder some questions.

1) How can I define a trigger for auto increment property ?

2) Is there a way to define column store table and auto-increment in HANA with EclipseLink ?

3) Is it possible to add auto ID generation property with alter table sql command for my table ?

4) How can I provide ID generation and association in .hdbdd file ?

Regards.

Gokhan.

Accepted Solutions (0)

Answers (0)