I've put together a simple persistence example, but unfortunately it doesn't 
work and I can't figure out why (I originally thought I was misusing 
Stripersist, but after some clarification realized that was not the case). 
Following are the pertinent pieces of code, if anyone sees what is wrong please 
let me know. Note: the error stack shows NullPointerException - 
practice.example.dao.BookDao.listBooks (BookDao.java:16)
.

/* BookDao.java */
public class BookDao {
    @SuppressWarnings("unchecked")
    public List<Book> listBooks(){
        return Stripersist.getEntityManager().createQuery("from 
Book").getResultList();
    }
}

/* Book.java */
@Entity 
@Table(name="books")
public class Book {
    
    @Id
    @GeneratedValue
    @Column(name="id")
    private int id;
    
    @Column(name="title")
    private String title;
    
    @Column(name="author_name")
    private String authorName;
    
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }

       /* The remaining getters/setters and an empty constructor */

-Dan



      

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to