论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Samita Bhujbal
Table autoincrement property gets removed
2013年3月6日 下午10:47
答复

Samita Bhujbal

等级: Regular Member

帖子: 120

加入日期: 2011年7月5日

最近的帖子

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年3月7日 上午1:20
答复

Bart Simpson

等级: Liferay Master

帖子: 524

加入日期: 2011年8月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年3月7日 上午2:32
答复

Samita Bhujbal

等级: Regular Member

帖子: 120

加入日期: 2011年7月5日

最近的帖子

I did it. But CounterLocalServiceUtil generates duplicate primaryid sometimes. Hence I changed to this.
Siby Mathew
RE: Table autoincrement property gets removed
2013年3月7日 上午5:54
答复

Siby Mathew

等级: Expert

帖子: 267

加入日期: 2011年3月4日

最近的帖子

Have you implemented like this :
1CounterLocalServceUtil.increment(yourEntity.class.getName());
Sampsa Sohlman
RE: Table autoincrement property gets removed
2013年3月7日 上午8:19
答复

Sampsa Sohlman

LIFERAY STAFF

等级: Regular Member

帖子: 226

加入日期: 2007年9月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年3月8日 上午12:24
答复

Jaynil A Bagdai

等级: Regular Member

帖子: 120

加入日期: 2012年3月3日

最近的帖子

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年3月13日 上午5:56
答复

Samita Bhujbal

等级: Regular Member

帖子: 120

加入日期: 2011年7月5日

最近的帖子

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年3月13日 上午5:58
答复

Samita Bhujbal

等级: Regular Member

帖子: 120

加入日期: 2011年7月5日

最近的帖子

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