フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Samita Bhujbal
Table autoincrement property gets removed
2013/03/06 22:47
答え

Samita Bhujbal

ランク: Regular Member

投稿: 120

参加年月日: 2011/07/05

最近の投稿

I am using Liferay 6.0.6. I am working on custom module for membership registration. I am using service builder for dealing with tables.. There are 20 tables involved on this module. I have made each table primary key autoincrement from SQLYog so that when data gets added in table it increments primary key automatically.
But sometimes this autoincrement property gets removed automatically. Also we have applied unique index to one table for one column. That also gets deleted automatically sometimes.
What Can be the reason? Is it due to I have set cron job on server which takes daily backup of database ? Or it may due to uploading the updated build on server??
Bart Simpson
RE: Table autoincrement property gets removed
2013/03/07 1:20
答え

Bart Simpson

ランク: Liferay Master

投稿: 524

参加年月日: 2011/08/29

最近の投稿

Each time you deploy with change in the service.xml Liferay will check for any changes and update the tables .
I have made each table primary key autoincrement from SQLYog

I don't understand why you did this and not do it the way liferay does it? (CounterService)
Samita Bhujbal
RE: Table autoincrement property gets removed
2013/03/07 2:32
答え

Samita Bhujbal

ランク: Regular Member

投稿: 120

参加年月日: 2011/07/05

最近の投稿

I did it. But CounterLocalServiceUtil generates duplicate primaryid sometimes. Hence I changed to this.
Siby Mathew
RE: Table autoincrement property gets removed
2013/03/07 5:54
答え

Siby Mathew

ランク: Expert

投稿: 265

参加年月日: 2011/03/04

最近の投稿

Have you implemented like this :
1CounterLocalServceUtil.increment(yourEntity.class.getName());
Sampsa Sohlman
RE: Table autoincrement property gets removed
2013/03/07 8:19
答え

Sampsa Sohlman

LIFERAY STAFF

ランク: Regular Member

投稿: 225

参加年月日: 2007/09/27

最近の投稿

Hi Samita,

Samita Bhujbal:
I did it. But CounterLocalServiceUtil generates duplicate primaryid sometimes. Hence I changed to this.


Can you repeat this behavior and which situation you are getting this?
Jaynil A Bagdai
RE: Table autoincrement property gets removed
2013/03/08 0:24
答え

Jaynil A Bagdai

ランク: Regular Member

投稿: 120

参加年月日: 2012/03/03

最近の投稿

Hi Samita,

Do avoid these kind of issues use
1
2CounterLocalServceUtil.increment();


Without giving entity name as parameter, this will always return you new and unique key for sure..

hope this helps you.

Thanks,
Jaynil
Samita Bhujbal
RE: Table autoincrement property gets removed
2013/03/13 5:56
答え

Samita Bhujbal

ランク: Regular Member

投稿: 120

参加年月日: 2011/07/05

最近の投稿

yes I did this only. But sometimes it was creating duplicate primaryID. So I removed this from code and set primaryId column as autoincremented in Mysql.
Samita Bhujbal
RE: Table autoincrement property gets removed
2013/03/13 5:58
答え

Samita Bhujbal

ランク: Regular Member

投稿: 120

参加年月日: 2011/07/05

最近の投稿

But when we want to add entries for specific entity then giving entity name is necessary.