-->
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.  [ 3 posts ] 
Author Message
 Post subject: Error: undefined alias: de [....
PostPosted: Sat Sep 13, 2003 9:31 am 
Newbie

Joined: Mon Sep 08, 2003 12:45 pm
Posts: 10
Hi,

I'm using JBoss 3.0.3 with Hibernate 2.1beta3 and Struts 1.1.

When I'm running a JSP that executes the Action LoginAction.java, I get the following error:
javax.servlet.ServletException: undefined alias: de [FROM de.hibernatemysqltest.User user WHERE (user.userName=? AND user.password=?)]

Here is the relvant part of the LoginAction.execute method (I've put some outputs inside. Some notes after the code snippet):
Context ctx = new InitialContext();
SessionFactory factory = (SessionFactory)ctx.lookup("java:/hibernate/HibernateFactory");
Session session = factory.openSession();

// Get all registered classes
Map allClassMetaDataMap = factory.getAllClassMetadata();
System.out.println("[" + this.getClass().getName() + "] get all class metadata");
for (Iterator allClassMetaData = allClassMetaDataMap.keySet().iterator(); allClassMetaData.hasNext();)
{
// ClassMetadata classMetaData = (ClassMetadata)allClassMetaData.next();
// System.out.println("[" + this.getClass().getName() + "] " + classMetaData.toString());
Object classMetaDataKey = allClassMetaData.next();
System.out.println("[" + this.getClass().getName() + "] key of type: " + classMetaDataKey.getClass().getName());
net.sf.hibernate.persister.EntityPersister classMetaDataVal = (net.sf.hibernate.persister.EntityPersister)allClassMetaDataMap.get(classMetaDataKey);
if (classMetaDataKey != null)
{
System.out.println("[" + this.getClass().getName() + "] val of type: " + classMetaDataVal.getClass().getName()+ " (" + classMetaDataVal.getMappedClass().getName() + ")");
}
else
{
System.out.println("[" + this.getClass().getName() + "] val does not exist");
}
}

// Load all users
System.out.println("[" + this.getClass().getName() + "] get user name and password");
[i]// Error !!! [/i]
List users = session.find(
qryUser,
new Object[]{loginForm.getUserName(), loginForm.getPassword()},
qryUserTypes
);
if (users.size() == 0)
{
System.out.println("[" + this.getClass().getName() + "] Log in");
retFwd = mapping.findForward("success");
}
else
{
System.out.println("[" + this.getClass().getName() + "] Do not log in");
retFwd = mapping.findForward("login");
}
// Finish Hibernate session
session.disconnect();
session.close();

The output of the snippet:
2003-09-13 15:15:14,320 INFO [STDOUT] [de.sam.strutstest.action.LoginAction] processing method execute
2003-09-13 15:15:14,336 INFO [STDOUT] [de.sam.strutstest.action.LoginAction] get all class metadata
2003-09-13 15:15:14,336 INFO [STDOUT] [de.sam.strutstest.action.LoginAction] key of type: java.lang.Class
2003-09-13 15:15:14,336 INFO [STDOUT] [de.sam.strutstest.action.LoginAction] val of type: net.sf.hibernate.persister.EntityPersister (de.sam.strutstest.dto.User)
2003-09-13 15:15:14,336 INFO [STDOUT] [de.sam.strutstest.action.LoginAction] get user name and password


I've put some code inside to see if the persitent class de.sam.strutstest.dto.User is registered in the session. This is ok. I don't know what's the meaning of the error message.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 13, 2003 9:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Why are you calling it "de.hibernatemysqltest.User" somewhere and "de.sam.strutstest.dto.User" somewhere else?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 13, 2003 10:13 am 
Newbie

Joined: Mon Sep 08, 2003 12:45 pm
Posts: 10
Oh, I'm sorry to post this message. I copied the file from another test project and didn't changed the class path. I'm very stupid and trying to check my problems more carefully for the future.


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

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.