Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
Articles_cn
Articles_de
Articles_pt
Articles_zh
HibernateRelationshi...




JSPWiki v2.2.33

[RSS]


Hide Menu

HibernateRelationships


Difference between version 74 and version 73:

At line 571 changed 1 line.
Then create the Hibernate implementation of the interfaces in the src/dao/**/dao/hibernate directory.
Then create the Hibernate implementations of the interfaces in the src/dao/**/dao/hibernate directory.
At line 602 added 1 line.
At line 623 added 82 lines.
!EntryDAOHibernate
[{Java2HtmlPlugin
package org.appfuse.dao.hibernate;
import java.util.List;
import org.appfuse.dao.EntryDAO;
import org.appfuse.model.Entry;
import org.springframework.orm.ObjectRetrievalFailureException;
public class EntryDAOHibernate extends BaseDaoHibernate implements EntryDAO {
public Entry getEntry(Long entryId) {
Entry entry = (Entry) getHibernateTemplate().get(Entry.class, entryId);
if (entry == null) {
log.warn("uh oh, weblog '" + entryId + "' not found...");
throw new ObjectRetrievalFailureException(Entry.class, entryId);
}
return entry;
}
public List getEntries(Entry entry) {
return getHibernateTemplate().find("from Entry e order by upper(e.timeCreated)");
}
public void saveEntry(final Entry entry) {
getHibernateTemplate().saveOrUpdate(entry);
}
public void removeEntry(Long entryId) {
getHibernateTemplate().delete(getEntry(entryId));
}
}
}]
!CategoryDAOHibernate
[{Java2HtmlPlugin
package org.appfuse.dao.hibernate;
import java.util.List;
import org.appfuse.dao.CategoryDAO;
import org.appfuse.model.Category;
import org.springframework.orm.ObjectRetrievalFailureException;
public class CategoryDAOHibernate extends BaseDaoHibernate implements CategoryDAO {
public Category getCategory(Long categoryId) {
Category category = (Category) getHibernateTemplate().get(Category.class, categoryId);
if (category == null) {
log.warn("uh oh, weblog '" + categoryId + "' not found...");
throw new ObjectRetrievalFailureException(Category.class, categoryId);
}
return category;
}
public List getCategories(Category category) {
return getHibernateTemplate().find("from Category cat order by upper(cat.categoryName)");
}
public void saveCategory(final Category category) {
getHibernateTemplate().saveOrUpdate(category);
}
public void removeCategory(Long categoryId) {
getHibernateTemplate().delete(getCategory(categoryId));
}
}
}]

Back to HibernateRelationships, or to the Page History.