Changes for page Your First Rest Project

Last modified by Steve Peery on 2013/09/06 11:02

From version 27.1
edited by Filippo Laurìa
on 2013/07/22 12:51
Change comment: There is no comment for this version
To version 22.1
edited by Filippo Laurìa
on 2013/07/22 12:39
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -185,12 +185,10 @@
185 185  
186 186  If you did everything well, the list of attributes should look like this:
187 187  
188 -[[image:attach:list_wlock.png]]
188 +[[image:attach:list.png]]
189 189  
190 190  You will notice that the attributes have a column with a lock in it. When a lock is present, it will use the value of that attribute for //UPDATE ... WHERE attribute = ''// statement. This is to do optimistic locking, aka to prevent data conflict when the data object was modified by two different users. Using timestamps for optimistic locking is not a good idea because for certain RDBMS, the value can be different because of milliseconds, so remove the locks on the **creationDate** attribute. The final list should look like this:
191 191  
192 -[[image:attach:list.png]]
193 -
194 194  Next step is to create the **Author** entity. Create a new entity with **Author** at its name (and also as the table name), and for the class name, use **your.app.model.Author**. The attributes for this entity are:
195 195  
196 196  |=(((
... ... @@ -224,12 +224,10 @@
224 224  
225 225  Final list of attributes should look like this:
226 226  
227 -[[image:attach:author_list.png]]
225 +[[image:attach:list.png]]
228 228  
229 229  Now, it's time to link the two entities together. An Author can have multiple blog entries, and a BlogEntry can only have one author. To create the relationship (the join), right-click on **Author** and select **New Relationship**. On your right, select **BlogEntry** in the list. On your left, select **to many BlogEntries**, and on your right, select **to one Author**. Now, in BlogEntry, we need to store the primary key of the author so that we can make the join. The relationship builder allow us to add that attribute, so make sure **and a new foreign key named** is checked (it is checked by default). The **Create Relationship** pane should look like this:
230 230  
231 -[[image:attach:relationship.png]]
232 -
233 233  If you check in the **Outline** tab, you should see that **Author** now have a **blogEntries** relationship, and **BlogEntry** have a **author** relationship.
234 234  
235 235  You are now ready to save the model. Save it (File -> Save) and close the **Entity Modeler** window. If you open the **Sources** in the main Eclipse window, you will notice that the **Sources** folder contains a package named **your.app.model**. (If this folder doesn't appear, you may need to set your preferences to automatically generate these source files; see the second suggestion on [[http:~~/~~/wiki.wocommunity.org/display/documentation/Useful+Eclipse+or+WOLips+Preferences>>url:http://wiki.wocommunity.org/display/documentation/Useful+Eclipse+or+WOLips+Preferences||rel="nofollow" shape="rect" class="external-link"]].)