core icon indicating copy to clipboard operation
core copied to clipboard

Binary fields can not be deleted from Content Types

Open agomez-dotcms opened this issue 9 years ago • 2 comments

Deleting a Binary field from a Content Type is an action that can not be accomplished, and instead, the system throws an error in log.

Expected Behavior

System should be able to delete the Binary field with no errors in log

Current Behavior

Following is the error thrown in log: [17/02/17 12:06:44:658 CST] ERROR job.DeleteFieldJob: Unable to delete field 'mybinaryfield'. Field Inode: 36986d77-5c8f-482c-b611-d65e4c13f05e, Structure Inode: ddf29c1e-babd-40a8-bfed-920fc9b8c77f com.dotmarketing.exception.DotHibernateException: Error deleting object at com.dotmarketing.db.HibernateUtil.delete(HibernateUtil.java:222) ~[dotcms_4.0_999999.jar:?] at com.dotmarketing.factories.InodeFactory.deleteInode(InodeFactory.java:1257) ~[dotcms_4.0_999999.jar:?] at com.dotmarketing.portlets.structure.factories.FieldFactory.deleteField(FieldFactory.java:120) ~[dotcms_4.0_999999.jar:?] at com.dotmarketing.quartz.job.DeleteFieldJob.execute(DeleteFieldJob.java:137) [dotcms_4.0_999999.jar:?] at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [dot.quartz-all-1.8.6_2.jar:?] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [dot.quartz-all-1.8.6_2.jar:?] Caused by: com.dotcms.repackage.net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 36986d77-5c8f-482c-b611-d65e4c13f05e, of class: com.dotmarketing.portlets.structure.model.Field at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.delete(SessionImpl.java:1151) ~[dot.hibernate-2.1.7_2.jar:?] at com.dotmarketing.db.HibernateUtil.delete(HibernateUtil.java:219) ~[dotcms_4.0_999999.jar:?] ... 5 more

Steps to Reproduce (for bugs)

  1. Login to dotCMS's Back-End
  2. Go to Content Types portlet
  3. Select any existing Content Type (for example: "Employee")
  4. Add a Binary field to the Content Type
  5. After that, try to delete the Binary field that was just added
  6. Go to dotcms.log and see the exception

Context

This issue was originally reported by a client and is currently tracked by https://my.dotcms.com/tickets/detail.dot?id=4b18f553-8157-4557-bc61-f43a38884a14.

Your Environment

  • dotCMS version used: master-4.0
  • Browser Name and version: Firefox 50.0.2 (but might reproduce on another browsers as well)
  • Operating System and version: Mac OSX (but might reproduce on another OSs as well)
  • Application Server and version: Tomcat 8
  • Java Brand and version: Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
  • Database and version: MySQL (but might reproduce on another databases as well)

agomez-dotcms avatar Feb 17 '17 19:02 agomez-dotcms

PR: https://github.com/dotCMS/core/pull/11013

jgambarios avatar Mar 13 '17 14:03 jgambarios

Fixed, tested on master-4.0 // H2 // MySQL

bryanboza avatar Mar 13 '17 17:03 bryanboza