Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Samita Bhujbal
Table autoincrement property gets removed
6 de marzo de 2013 22:47
Respuesta

Samita Bhujbal

Ranking: Regular Member

Mensajes: 120

Fecha de incorporación: 5 de julio de 2011

Mensajes recientes

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
7 de marzo de 2013 1:20
Respuesta

Bart Simpson

Ranking: Liferay Master

Mensajes: 523

Fecha de incorporación: 29 de agosto de 2011

Mensajes recientes

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
7 de marzo de 2013 2:32
Respuesta

Samita Bhujbal

Ranking: Regular Member

Mensajes: 120

Fecha de incorporación: 5 de julio de 2011

Mensajes recientes

I did it. But CounterLocalServiceUtil generates duplicate primaryid sometimes. Hence I changed to this.
Siby Mathew
RE: Table autoincrement property gets removed
7 de marzo de 2013 5:54
Respuesta

Siby Mathew

Ranking: Expert

Mensajes: 261

Fecha de incorporación: 4 de marzo de 2011

Mensajes recientes

Have you implemented like this :
1CounterLocalServceUtil.increment(yourEntity.class.getName());
Sampsa Sohlman
RE: Table autoincrement property gets removed
7 de marzo de 2013 8:19
Respuesta

Sampsa Sohlman

LIFERAY STAFF

Ranking: Regular Member

Mensajes: 217

Fecha de incorporación: 27 de septiembre de 2007

Mensajes recientes

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
8 de marzo de 2013 0:24
Respuesta

Jaynil A Bagdai

Ranking: Regular Member

Mensajes: 120

Fecha de incorporación: 3 de marzo de 2012

Mensajes recientes

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
13 de marzo de 2013 5:56
Respuesta

Samita Bhujbal

Ranking: Regular Member

Mensajes: 120

Fecha de incorporación: 5 de julio de 2011

Mensajes recientes

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
13 de marzo de 2013 5:58
Respuesta

Samita Bhujbal

Ranking: Regular Member

Mensajes: 120

Fecha de incorporación: 5 de julio de 2011

Mensajes recientes

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