public News(int id) throws Exception { Database db = new Database(); db.connect(); News news = News.findById(db, id); db.close(); this.id = news.id; this.tmsp = news.tmsp; this.headline = news.headline; this.body = news.body; this.email = news.email; }
public static void main(String args[]) throws Exception { News news = new News(); news.setHeadline("Testando"); news.setTmsp("2011-04-11 11:00:00"); news.setBody("Body"); news.setEmail("*****@*****.**"); news.insert(); }
public static News findById(Database db, int id) throws Exception { return News.next( db.query("select id, tmsp, headline, body, email from tbNews where id = " + id)); }