Changes for page Your First Rest Project
Last modified by Steve Peery on 2013/09/06 11:02
From version 21.1
edited by Filippo Laurìa
on 2013/07/22 12:25
on 2013/07/22 12:25
Change comment:
There is no comment for this version
To version 22.1
edited by Filippo Laurìa
on 2013/07/22 12:39
on 2013/07/22 12:39
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -185,6 +185,8 @@ 185 185 186 186 If you did everything well, the list of attributes should look like this: 187 187 188 +[[image:attach:list.png]] 189 + 188 188 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: 189 189 190 190 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: ... ... @@ -220,6 +220,8 @@ 220 220 221 221 Final list of attributes should look like this: 222 222 225 +[[image:attach:list.png]] 226 + 223 223 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: 224 224 225 225 If you check in the **Outline** tab, you should see that **Author** now have a **blogEntries** relationship, and **BlogEntry** have a **author** relationship.