-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: DAO und RCP
PostPosted: Fri Feb 26, 2010 5:18 am 
Newbie

Joined: Fri Feb 26, 2010 5:01 am
Posts: 5
Hi,

ich programiere mit MyEclipse 8x ein RCP.
Meine Anwendung besteht aus 1 Projek
Der Zugriff auf die Datenbank erfolgt mit Hibernate 3.2., Annotations und DAO.
1.Plugin-Projekt: RCP, GUI, "Datenmodell", d.h. Entity-Klassen, Hibernate-Persistenz-Klassen, DAO, Businesslogik

Die Persistenz mittels Hibernate funktioniert in einem normalen Java-Projekt ohne RCP wunderbar.
Ich kann problemlos folgendes Objekt erzeugen: TitleDAO dao = new TitleDAO();

Sobald ich aber das Projekt also RCP starte, erhalte ich bei den Views Fehlermeldungen, deren Daten aus der Datenbank geladen werden sollen.
Von der View aus kann ich folgendes Objekt nicht erzeugen
TitleDAO dao = new TitleDAO();

Im folgenden der Code der Klassen View:
Code:
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
import org.server.model.provider.TitleProvider;

public class View extends ViewPart {
   public static final String ID = "org.javacrm.view";
   public void createPartControl(Composite parent) {
      TitleProvider titleProvider = new TitleProvider();
      titleProvider.addTitle();
   }
   public void setFocus() {
   }
}


Im folgenden der Code der Klassen, wo ich das DAO instanziere:
Code:
import java.sql.Timestamp;
import org.hibernate.Transaction;
import org.server.model.hibernate.*;

public class TitleProvider {
   public void addTitle() {
      // Create Title
      Title title = new Title();
      title.setTitleid(1);
      title.setCreationuser("user01");
      title.setCreationdate(Timestamp.valueOf("2010-02-25 09:01:10"));
      title.setModifyuser("user02");
      title.setModifydate(Timestamp.valueOf("2010-02-25 11:11:11"));
      title.setListposition(4);
      title.setTitlevalue("Frau");
      title.setTitlenotice("keine Anmerkung");
      // Create DAO
      TitleDAO dao = new TitleDAO();
      // Start the transaction
      Transaction tx = dao.getSession().beginTransaction();
      // Add Title
      dao.save(title);
      // Write to database
      tx.commit();
      // Close the session
      dao.getSession().close();
   }
}


Ich erhalte folgende Fehlermeldung:
java.lang.ClassNotFoundException: org.hibernate.criterion.Criterion
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at org.javacrm.server.model.provider.TitleProvider.addTitle(TitleProvider.java:29)
at org.javacrm.client.view.View.createPartControl(View.java:32)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:367)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:649)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:982)
at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2626)
at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2965)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2946)
at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:761)
at org.eclipse.ui.internal.Workbench$21.runWithException(Workbench.java:1045)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4312)
at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:94)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1379)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2335)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.javacrm.Application.start(Application.java:20)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.