掲示板

Not able to create previously deleted organization with the same name.

8年前 に Atul Soni によって更新されました。

Not able to create previously deleted organization with the same name.

New Member 投稿: 7 参加年月日: 15/02/13 最新の投稿
Hi All !

I have created business logic for the soft delete of the organization in liferay.

When some one add organization (EX: xyz ) then add custom field isDeleted value with false. If some one delete organization then it will work in folowing way.

1. Update organization and rename the organization name in to deleted_xyz_organizationId(EX : 12300), And change value of the custom field value isDeleted = true.

2. But when i add the organization with the same name of the xyz again then it shows the following error.
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '10154-10003-0-xyz LFR_ORGANIZATION' for key 'IX_5DE0BE11'

I thought it is cashing issue then i also removed database cash from the control panel.But steel it gives same error.

Please help me to solve this issue as soon as possible.
Thanks
8年前 に deveshree zawar によって更新されました。

RE: Not able to create previously deleted organization with the same name.

Junior Member 投稿: 61 参加年月日: 16/02/09 最新の投稿
Hi,

Could you help me understand the DB you are using?
I would suggest to, delete the index 'IX_5DE0BE11' related to the organization_ table from DB and try creating the organization again.

Thanks,
Deveshree
8年前 に Atul Soni によって更新されました。

RE: Not able to create previously deleted organization with the same name.

New Member 投稿: 7 参加年月日: 15/02/13 最新の投稿
Thanks deveshree for reply but i got the actual reason behind that !
Solution : if i make the logic explained above then i must have to rename organization in Group table as well.
Then and then i will able to create new organization of the same name which i deleted previously.
thumbnail
8年前 に Olaf Kock によって更新されました。

RE: Not able to create previously deleted organization with the same name.

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
Atul Soni:
if i make the logic explained above then i must have to rename organization in Group table as well.
Then and then i will able to create new organization of the same name which i deleted previously.


Does that mean that you implemented your business logic by changing the database value through SQL? If so, this is another example for why this is strictly forbidden and a recipe for disaster. You must only use the API to make any changes on Liferay's data.

If you're already using the API, let us know which function you're using - I'd consider this a bug in the implementation in that case. (However, it doesn't hurt to state again that writing to the DB - using SQL - should never be done)