Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Define Service Entities in liferay 6.2

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 132
    Comment on it

    Hello guys,

    Entities are the heart of a service which are defined in the service.xml in the liferay portlet. It represents the map between the model objects in Java and the fields/column and tables in your database. Once your entities are defined in service.xml, the mapping automatically handle by Service Builder.


    For this example, create entity for events. Heres a summary of the information well enter for the Event entity:-

    Name: Event
    Local service: yes
    Remote service: yes
    

    Below entity example will help to write service in liferay 6.2

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
    <service-builder package-path="com">
        <author>Events</author>
        <namespace>Events</namespace>
        <entity name="Event" table="Event" local-service="true" remote-service="true" cache-enabled="true">
            <!-- Primary Key  -->
            <column name="Eventid" type="long" primary="true" />
    
            <!-- Audit fields -->
            <column name="eventName" type="String" />
            <column name="eventDetails" type="String" />
            <column name="eventDate" type="Date" />
    
            <!-- Order by  -->
            <order by="asc">
                <order-column name="eventDate" />
            </order>
        </entity>
    </service-builder>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: