Пример #1
0
  public void configurePersistence(PlatformConfiguration pc) throws Exception {
    try {

      PlatformAnnotationConfiguration hibConfiguration =
          (PlatformAnnotationConfiguration) HibernateFactory.getConfig();

      URL ce = HibernateFactory.class.getClassLoader().getResource("qa.hbm.xml");
      hibConfiguration.addURL(ce);
      hibConfiguration.addAnnotatedClass(Tag.class);
      hibConfiguration.addAnnotatedClass(Category.class);
      // hibConfiguration.addAnnotatedClass(Badge.class);
      hibConfiguration.addAnnotatedClass(Question.class);
      hibConfiguration.addAnnotatedClass(QuestionRevision.class);
      hibConfiguration.addAnnotatedClass(Answer.class);
      hibConfiguration.addAnnotatedClass(AnswerRevision.class);
      hibConfiguration.addAnnotatedClass(Comment.class);
      hibConfiguration.addAnnotatedClass(Upvote.class);
      hibConfiguration.addAnnotatedClass(Hit.class);
      hibConfiguration.addAnnotatedClass(StickyNote.class);

    } catch (MappingException e) {
      throw new RuntimeException(e);
    }
  }
Пример #2
0
 public static Identifiable findByPrimaryKey(Class<? extends Identifiable> clazz, Serializable id)
     throws FindByPrimaryKeyException {
   return HibernateFactory.findByPrimaryKey(clazz, id);
 }
Пример #3
0
 public static void initialize(Object o) throws HibernateException {
   HibernateFactory.initialize(o);
 }
Пример #4
0
 public static boolean isInitialized(Object o) {
   return HibernateFactory.isInitialized(o);
 }
Пример #5
0
 public static void remove(IdentifiableSupport i, PersistenceContext pc) throws RemoveException {
   HibernateFactory.remove(i, pc.session);
 }
Пример #6
0
 public static void store(Identifiable i, PersistenceContext pc) throws StoreException {
   HibernateFactory.store(i, pc);
 }