I will explain my situation:
I'm a student at the University of Antwerp. We are making a webproject with
lessons a student can follow. Compiler support for computer languages must
also be available. We had allready part of it working. But the problem is we
can't unittest. It is necessary!
So we need to redesign our classes. It seemed that these classes were just the
classes of our db. So I searched for a ORM. 2 Candidates : Cayenne and
Hibernate. I tried Cayenne after reading a few posts on other mailing lists.
What I did:
downloaded cayenne.
setted my CAYENNE_HOME to the directory where I installed it.
ran modeler.sh
created new datanode and filled in all the fields.
reengineered database schema
generated classes and saved them in my src folder of eclipse.
saved the files(cayenne.xml, driver.xml and map.xml) in the src folder of
eclipse.
added cayenne-nodeps.jar to eclipse (by using insert external jar)
copied the cayenne-nodeps.jar to my tomcat/shared/lib directory.
checked the orcabol_koen.xml in tomcat/conf/Catalina/localhost:
<Context path="/koen" docBase="/home/koen/workspace/orcabol/context"
reloadable="true"/>
Changed few files in eclipse:
Inserted this in Visit.java:
private DataContext dataContext;
public DataContext getDataContext() {
if (dataContext == null) {
dataContext = DataContext.createDataContext();
}
return dataContext;
}
Changed my Login.java so that it works with cayenne (will become a method in
users.java, but here the login was before)
String loginmessage="";
Visit visit = (Visit)getVisit();
DataContext context = visit.getDataContext();
Expression qualifier = Expression.fromString("name equals "+getUserName()+"
and password equals "+ getPassword());
SelectQuery query = new SelectQuery(Users.class, qualifier);
List users = context.performQuery(query);
if (users.size()==1){
Users user = (Users)users.get(0);
visit.setUserID(4);
loginmessage+="You are authorized.<br>";
loginmessage+="Your id is " + visit.getUserID()+"<br>";
loginmessage+="Your authentication level is " + user.getAuthlevel();
//global.log(ID, "succesfully logged in");
}
else{
loginmessage="You are not authorised";
}
visit.setMessage("Welcome "+UserName+",<br>"+loginmessage);
cycle.activate("Message");
Eclipse doesn't give any error messages (except a test that doesn't work
anymore)
That's all I did.
Maybe I forgot something?
Plz help ...
If it doesn't work for today I need to look to Hibernate...
Although I believe the fault is really simple...
Greetz and thx for the replies !
On Friday 11 February 2005 20:51, Gentry, Michael (Contractor) wrote:
> Eclipse should copy it to your build folder (where it puts your built
> classes, if you configured it to have a split output folder). Make sure
> that your cayenne.xml file is located where your class files are. If
> not, Eclipse might not know that it's a resource.
>
> Eclipse will include the classes it builds in your CLASSPATH by default.
>
> Hope that helps some more ...
>
> /dev/mrg
>
>
> -----Original Message-----
> From: Koen Segers [mailto:KoenSeger..carlet.be]
> Sent: Friday, February 11, 2005 2:39 PM
> To: cayenne-use..bjectstyle.org
> Subject: Re: NEWBIE: cayenne.xml
>
> On Friday 11 February 2005 20:13, Gentry, Michael (Contractor) wrote:
> > By default, it needs to be in your CLASSPATH.
>
> Where is this? or how can I set this?
>
> > I usually configure an
> > Eclipse project with separate folders ("src" and "bin") and put
> > "cayenne.xml" under the "src" folder.
>
> it is located in the src folder...
>
> > When Eclipse builds the project,
> > though, it copies "src/cayenne.xml" to "bin/cayenne.xml", so be
>
> careful
>
> > you only edit the "src" one.
>
> Thx for the fast reply!
>
> > /dev/mrg
> >
> > -----Original Message-----
> > From: Koen Segers [mailto:KoenSeger..carlet.be]
> > Sent: Friday, February 11, 2005 2:09 PM
> > To: cayenne-use..bjectstyle.org
> > Subject: NEWBIE: cayenne.xml
> >
> >
> > Where must i put the cayenne.xml file?
> > I'm working with spindle in eclipse.
> > I always get this error:
> > [v.1.1 December 6 2004]
> > [org.objectstyle.cayenne.conf.DefaultConfiguration] :
> > Domain configuration file "cayenne.xml" is not found.
--Koen Segers
<koenseger..carlet.be> <http://eddyvite.dyndns.org>
This archive was generated by hypermail 2.0.0 : Sat Feb 12 2005 - 06:36:27 EST