Changeset 5728


Ignore:
Timestamp:
Sep 8, 2011, 3:31:28 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1597: Subtypes of items

Added unique constraint on the subtype+datafiletype combination. Seems like the updatedb script is creating duplicate links... needs to be fixed...

Location:
trunk/src/core/net/sf/basedb/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Install.java

    r5713 r5728  
    26362636      {
    26372637        log.info("createDataFileType: EXISTS [externalId="+externalId+"]");
    2638         if (itemSubtypes != null)
     2638        /*
     2639        TODO #1591: Make sure that updating create proper file type links
     2640        if (itemSubtypes != null && schemaVersion.getSchemaVersion() < 100)
    26392641        {
    2640           if (itemSubtypes != null)
     2642          for (ItemSubtypeFT sft : itemSubtypes)
    26412643          {
    2642             for (ItemSubtypeFT sft : itemSubtypes)
    2643             {
    2644               ItemSubtypeFileTypeData subtypeFile = new ItemSubtypeFileTypeData();
    2645               subtypeFile.setItemSubtype(sft.subtype);
    2646               subtypeFile.setDataFileType(fileType);
    2647               subtypeFile.setRequired(sft.required);
    2648               subtypeFile.setAllowMultiple(sft.multiple);
    2649               HibernateUtil.saveData(session, subtypeFile);
    2650             }
     2644            ItemSubtypeFileTypeData subtypeFile = new ItemSubtypeFileTypeData();
     2645            subtypeFile.setItemSubtype(sft.subtype);
     2646            subtypeFile.setDataFileType(fileType);
     2647            subtypeFile.setRequired(sft.required);
     2648            subtypeFile.setAllowMultiple(sft.multiple);
     2649            HibernateUtil.saveData(session, subtypeFile);
    26512650          }
    26522651        }
     2652        */
    26532653        HibernateUtil.commit(tx);
    26542654      }
  • trunk/src/core/net/sf/basedb/core/data/ItemSubtypeFileTypeData.java

    r5713 r5728  
    4141    Get the file type.
    4242    @hibernate.many-to-one outer-join="false" update="false"
    43     @hibernate.column name="`datafiletype_id`" not-null="true"
     43    @hibernate.column name="`datafiletype_id`" not-null="true" unique-key="uniquefile"
    4444  */
    4545  public DataFileTypeData getDataFileType()
     
    5656    Get the item subtype.
    5757    @hibernate.many-to-one outer-join="false" update="false"
    58     @hibernate.column name="`subtype_id`" not-null="true"
     58    @hibernate.column name="`subtype_id`" not-null="true" unique-key="uniquefile"
    5959  */
    6060  public ItemSubtypeData getItemSubtype()
Note: See TracChangeset for help on using the changeset viewer.