I've made the change in the tutorials code in SVN.  Now we just need
to update the tutorials.  Attached is the diff.

I don't have time to update the tutorials today, but I'd like to start
using Confluence's snippet plugin to auto-synch the sources.

http://confluence.atlassian.com/display/CONFEXT/Snippet+Plugin

wnqq (that's not your real name is it? ;-) - can you please enter an
issue in JIRA for this so we can track it in the release notes?

Thanks,

Matt

On 3/9/07, Bryan Noll <[EMAIL PROTECTED]> wrote:

 Thanks for the feedback.  I went and checked the code to make sure the same
issues did not exist there.  Could you please paste the url of the exact
tutorial you're seeing the mistake on so I can go correct it?

 Thanks

 wnqq wrote:
 I did not track all the places of weird code, so I just quickly browsed the
page again......

Got one more on the same page:

private PersonDao<Person, Long> personDao = null;

it should then be modified as:

private PersonDao personDao = null;



mraible wrote:


 You said several pieces are weird, but you've only listed one. Are there
more?

Matt

On 3/8/07, wnqq <[EMAIL PROTECTED]> wrote:


 Several code pieces regarding java generics in the appfuse2 tutorials are
weird.
For example, in the hibernate tutorial:
http://appfuse.org/display/APF/Using+Hibernate

The code:

public interface PersonDao<T, PK extends java.io.Serializable> extends
GenericDao {

should be:

public interface PersonDao extends GenericDao <Person, Long> {


--
View this message in context:
http://www.nabble.com/improper-usages-of-generics-in-tutorials-tf3373931s2369.html#a9388982
Sent from the AppFuse - User mailing list archive at Nabble.com.






--
http://raibledesigns.com
Index: tutorial-hibernate/src/main/java/org/appfuse/tutorial/dao/PersonDao.java
===================================================================
--- tutorial-hibernate/src/main/java/org/appfuse/tutorial/dao/PersonDao.java	(revision 46)
+++ tutorial-hibernate/src/main/java/org/appfuse/tutorial/dao/PersonDao.java	(working copy)
@@ -1,13 +1,13 @@
-package org.appfuse.tutorial.dao;
-
-import org.appfuse.dao.GenericDao;
-import org.appfuse.tutorial.model.Person;
-
-import java.util.List;
-
-/**
- * @author mraible
- */
-public interface PersonDao<T, PK extends java.io.Serializable> extends GenericDao {
-    public List<Person> findByLastName(String lastName);
-}
+package org.appfuse.tutorial.dao;
+
+import org.appfuse.dao.GenericDao;
+import org.appfuse.tutorial.model.Person;
+
+import java.util.List;
+
+/**
+ * @author mraible
+ */
+public interface PersonDao extends GenericDao<Person, Long> {
+    public List<Person> findByLastName(String lastName);
+}
Index: tutorial-hibernate/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java
===================================================================
--- tutorial-hibernate/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java	(revision 46)
+++ tutorial-hibernate/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java	(working copy)
@@ -1,47 +1,47 @@
-package org.appfuse.tutorial.dao;
-
-import org.appfuse.dao.BaseDaoTestCase;
-import org.appfuse.tutorial.model.Person;
-import org.springframework.dao.DataAccessException;
-
-import java.util.List;
-
-public class PersonDaoTest extends BaseDaoTestCase {
-    private PersonDao<Person, Long> personDao = null;
-
-    public void setPersonDao(PersonDao<Person, Long> personDao) {
-        this.personDao = personDao;
-    }
-
-    public void testFindPersonByLastName() throws Exception {
-        List<Person> people = personDao.findByLastName("Raible");
-        assertTrue(people.size() > 0);
-    }
-
-    public void testAddAndRemovePerson() throws Exception {
-        Person person = new Person();
-        person.setFirstName("Country");
-        person.setLastName("Bry");
-
-        personDao.save(person);
-        flush();
-
-        person = (Person) personDao.get(person.getId());
-
-        assertEquals("Country", person.getFirstName());
-        assertNotNull(person.getId());
-
-        log.debug("removing person...");
-
-        personDao.remove(person.getId());
-        flush();
-
-        try {
-            personDao.get(person.getId());
-            fail("Person found in database");
-        } catch (DataAccessException dae) {
-            log.debug("Expected exception: " + dae.getMessage());
-            assertNotNull(dae);
-        }
-    }
-}
+package org.appfuse.tutorial.dao;
+
+import org.appfuse.dao.BaseDaoTestCase;
+import org.appfuse.tutorial.model.Person;
+import org.springframework.dao.DataAccessException;
+
+import java.util.List;
+
+public class PersonDaoTest extends BaseDaoTestCase {
+    private PersonDao personDao = null;
+
+    public void setPersonDao(PersonDao personDao) {
+        this.personDao = personDao;
+    }
+
+    public void testFindPersonByLastName() throws Exception {
+        List<Person> people = personDao.findByLastName("Raible");
+        assertTrue(people.size() > 0);
+    }
+
+    public void testAddAndRemovePerson() throws Exception {
+        Person person = new Person();
+        person.setFirstName("Country");
+        person.setLastName("Bry");
+
+        personDao.save(person);
+        flush();
+
+        person = (Person) personDao.get(person.getId());
+
+        assertEquals("Country", person.getFirstName());
+        assertNotNull(person.getId());
+
+        log.debug("removing person...");
+
+        personDao.remove(person.getId());
+        flush();
+
+        try {
+            personDao.get(person.getId());
+            fail("Person found in database");
+        } catch (DataAccessException dae) {
+            log.debug("Expected exception: " + dae.getMessage());
+            assertNotNull(dae);
+        }
+    }
+}
Index: tutorial-jpa/src/main/java/org/appfuse/tutorial/dao/PersonDao.java
===================================================================
--- tutorial-jpa/src/main/java/org/appfuse/tutorial/dao/PersonDao.java	(revision 46)
+++ tutorial-jpa/src/main/java/org/appfuse/tutorial/dao/PersonDao.java	(working copy)
@@ -8,6 +8,6 @@
 /**
  * @author mraible
  */
-public interface PersonDao<T, PK extends java.io.Serializable> extends GenericDao {
+public interface PersonDao extends GenericDao<Person, Long> {
     public List<Person> findByLastName(String lastName);
 }
Index: tutorial-jpa/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java
===================================================================
--- tutorial-jpa/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java	(revision 46)
+++ tutorial-jpa/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java	(working copy)
@@ -7,9 +7,9 @@
 import java.util.List;
 
 public class PersonDaoTest extends BaseDaoTestCase {
-    private PersonDao<Person, Long> personDao = null;
+    private PersonDao personDao = null;
 
-    public void setPersonDao(PersonDao<Person, Long> personDao) {
+    public void setPersonDao(PersonDao personDao) {
         this.personDao = personDao;
     }
 
Index: tutorial-struts2/src/main/java/org/appfuse/tutorial/dao/PersonDao.java
===================================================================
--- tutorial-struts2/src/main/java/org/appfuse/tutorial/dao/PersonDao.java	(revision 46)
+++ tutorial-struts2/src/main/java/org/appfuse/tutorial/dao/PersonDao.java	(working copy)
@@ -1,13 +1,13 @@
-package org.appfuse.tutorial.dao;
-
-import org.appfuse.dao.GenericDao;
-import org.appfuse.tutorial.model.Person;
-
-import java.util.List;
-
-/**
- * @author mraible
- */
-public interface PersonDao<T, PK extends java.io.Serializable> extends GenericDao {
-    public List<Person> findByLastName(String lastName);
-}
+package org.appfuse.tutorial.dao;
+
+import org.appfuse.dao.GenericDao;
+import org.appfuse.tutorial.model.Person;
+
+import java.util.List;
+
+/**
+ * @author mraible
+ */
+public interface PersonDao extends GenericDao<Person, Long> {
+    public List<Person> findByLastName(String lastName);
+}
Index: tutorial-struts2/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java
===================================================================
--- tutorial-struts2/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java	(revision 46)
+++ tutorial-struts2/src/test/java/org/appfuse/tutorial/dao/PersonDaoTest.java	(working copy)
@@ -1,43 +1,43 @@
-package org.appfuse.tutorial.dao;
-
-import org.appfuse.dao.BaseDaoTestCase;
-import org.appfuse.tutorial.model.Person;
-import org.springframework.dao.DataAccessException;
-
-import java.util.List;
-
-public class PersonDaoTest extends BaseDaoTestCase {
-    private PersonDao<Person, Long> personDao = null;
-
-    public void setPersonDao(PersonDao<Person, Long> personDao) {
-        this.personDao = personDao;
-    }
-
-    public void testFindPersonByLastName() throws Exception {
-        List<Person> people = personDao.findByLastName("Raible");
-        assertTrue(people.size() > 0);
-    }
-
-    public void testAddAndRemovePerson() throws Exception {
-        Person person = new Person();
-        person.setFirstName("John");
-        person.setLastName("Elway");
-
-        personDao.save(person);
-
-        assertEquals("John", person.getFirstName());
-        assertNotNull(person.getId());
-
-        log.debug("removing person...");
-
-        personDao.remove(person.getId());
-
-        try {
-            personDao.get(person.getId());
-            fail("Person found in database");
-        } catch (DataAccessException dae) {
-            log.debug("Expected exception: " + dae.getMessage());
-            assertNotNull(dae);
-        }
-    }
-}
+package org.appfuse.tutorial.dao;
+
+import org.appfuse.dao.BaseDaoTestCase;
+import org.appfuse.tutorial.model.Person;
+import org.springframework.dao.DataAccessException;
+
+import java.util.List;
+
+public class PersonDaoTest extends BaseDaoTestCase {
+    private PersonDao personDao = null;
+
+    public void setPersonDao(PersonDao personDao) {
+        this.personDao = personDao;
+    }
+
+    public void testFindPersonByLastName() throws Exception {
+        List<Person> people = personDao.findByLastName("Raible");
+        assertTrue(people.size() > 0);
+    }
+
+    public void testAddAndRemovePerson() throws Exception {
+        Person person = new Person();
+        person.setFirstName("John");
+        person.setLastName("Elway");
+
+        personDao.save(person);
+
+        assertEquals("John", person.getFirstName());
+        assertNotNull(person.getId());
+
+        log.debug("removing person...");
+
+        personDao.remove(person.getId());
+
+        try {
+            personDao.get(person.getId());
+            fail("Person found in database");
+        } catch (DataAccessException dae) {
+            log.debug("Expected exception: " + dae.getMessage());
+            assertNotNull(dae);
+        }
+    }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to