PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-12198

CLONE -service fails in a plugin when primitive wrappers are used as column type

    Details

    • Branch Version/s:
      6.0.x, 5.2.x, 5.1.x
    • Backported to Branch:
      Committed
    • Similar Issues:
      Show 4 results 

      Description

      Primitive wrapper types like Boolean and Integer are legal in service definition.
      But when any of the primitive wrappers are used as types for columns in a portlet or a web plugin's service, read fails with no errors and write fails with hibernate "MappingException: unknown entity".
      This is because the type is not generated in the hbm mapping file when type is not primitive. This causes Hibernate to use reflection which fails because the hibernate/portal classloader does not have the portlet's entity class.
      So type needs to be generated even for primitive wrappers.

        Activity

        Hide
        Jan Krueger added a comment -

        Sorry for cloning this issue, maybe this is not correct.
        But this one seems also the reason for: http://issues.liferay.com/browse/LPS-10194 or this similar problem with ServiceBuilder

        Even with SDK 6.0.5 and the latest Portal trunk (21.08.2010), there is a problem when generating services with primary key and NON primitive types.
        The Persistence class will not compile after building the service

        Example:

        <column name="herstellerNr" type="int" primary="true" id-type="increment" />

        public Customer remove(Serializable primaryKey)
        throws NoSuchModelException, SystemException

        { return remove(((Integer)primaryKey).intValue()); }

        No Error.

        <column name="herstellerNr" type="Integer" primary="true" id-type="increment" />
        public Customer remove(Serializable primaryKey)
        throws NoSuchModelException, SystemException

        { return remove(((Integer)primaryKey).IntegerValue()); }

        Error: The method IntegerValue() is undefined for the type Integer

        <column name="herstellerNr" type="Long" primary="true" id-type="increment" />
        public Customer remove(Serializable primaryKey)
        throws NoSuchModelException, SystemException

        { return remove(((Long)primaryKey).LongValue()); }

        Error: The method LongValue() is undefined for the type Long

        Same Problem also affects the methods "findByPrimaryKey" and "fetchByPrimaryKey" in the persistence-class

        Show
        Jan Krueger added a comment - Sorry for cloning this issue, maybe this is not correct. But this one seems also the reason for: http://issues.liferay.com/browse/LPS-10194 or this similar problem with ServiceBuilder Even with SDK 6.0.5 and the latest Portal trunk (21.08.2010), there is a problem when generating services with primary key and NON primitive types. The Persistence class will not compile after building the service Example: <column name="herstellerNr" type="int" primary="true" id-type="increment" /> public Customer remove(Serializable primaryKey) throws NoSuchModelException, SystemException { return remove(((Integer)primaryKey).intValue()); } No Error. <column name="herstellerNr" type="Integer" primary="true" id-type="increment" /> public Customer remove(Serializable primaryKey) throws NoSuchModelException, SystemException { return remove(((Integer)primaryKey).IntegerValue()); } Error: The method IntegerValue() is undefined for the type Integer <column name="herstellerNr" type="Long" primary="true" id-type="increment" /> public Customer remove(Serializable primaryKey) throws NoSuchModelException, SystemException { return remove(((Long)primaryKey).LongValue()); } Error: The method LongValue() is undefined for the type Long Same Problem also affects the methods "findByPrimaryKey" and "fetchByPrimaryKey" in the persistence-class

          People

          • Assignee:
            Prashant Dighe
            Reporter:
            Jan Krueger
            Recent user:
            Randy Zhu
            Participants of an Issue:
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              4 years, 28 weeks, 3 days ago

              Development

                Structure Helper Panel