Thank you to all! It's really work..
--- "Gentry, Michael (Contractor)"
<michael_gentr..anniemae.com> wrote:
> I should've added this, too ...
>
> If I'm creating my own DB/Schema, I like to name the
> tables plural --
> Users, Roles, Transactions, LineItems, etc, but name
> the classes
> singular -- User, Role, Transaction, LineItem, etc.
> This almost always
> ensures you won't use a DB reserved word and to me
> makes more sense (the
> Users table is a collection of all of the users, not
> just one, but a
> User object represents a single object from the
> Users table).
>
> /dev/mrg
>
> -----Original Message-----
> From: Gentry, Michael (Contractor)
> [mailto:michael_gentr..anniemae.com]
>
> Sent: Tuesday, June 07, 2005 2:06 PM
> To: cayenne-use..bjectstyle.org
> Subject: RE: Trouble with SQLServerDriver
>
>
> Yeah, you have to be careful with DB reserved words.
> Our schema has a
> TransactionTable which maps to a Transaction object.
> Can't name the
> table Transaction, too, because that is an SQL word.
> The easiest thing
> for you to do is call your table UserTable (or
> similar), but name your
> class User so it functions as you are expecting.
>
> /dev/mrg
>
>
> -----Original Message-----
> From: Andrus Adamchik
> [mailto:andru..bjectstyle.org]
> Sent: Tuesday, June 07, 2005 12:20 PM
> To: cayenne-use..bjectstyle.org
> Subject: Re: Trouble with SQLServerDriver
>
>
> I'd guess this is because "User" is a SQLServer
> keyword and it requires
> special handling when used as identifier.
>
> We have a bug report already -
>
http://objectstyle.org/cayenne/lists/cayenne-devel/2005/06/0003.html
> (I
> guess I'll raise it in priority as this seems to
> come up pretty often).
>
> One workaround would be to use a different name for
> this table. Another
> way (I haven't tested it, but it should probably
> work) is to enter
> [User]
> as a table name in CayenneModeler.
>
> Hope this helps
> Andrus
>
>
> > Hi.
> >
> > I'm trying to use Cayenne orm-tool for some small
> test
> > project using Microsoft SQL server database. And
> there
> > are many exceptions during all work with
> DataObjects,
> > for example:
> >
> > 1.)
> > ...
> > DataContext ctxt =
> >
>
BasicServletConfiguration.getDefaultContext(request.getSession());
> > SelectQuery query = new SelectQuery(User.class);
> > List users = ctxt.performQuery(query);
> > ...
> >
> > throw
> > "
> > Caused by: java.sql.SQLException:
> > [Microsoft][SQLServer 2000 Driver for
> > JDBC][SQLServer]Incorrect syntax near the keyword
> > 'User'.
> > at
> >
>
com.microsoft.jdbc.base.BaseExceptions.createException(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unk
> nown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Un
> known
> > Source)
> > at
> >
>
com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown
> > Source)
> > at
> >
>
org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:386)
> > at
> >
>
org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:350
> )
> > ... 23 more
> > "
> >
> > 2.)
> > ...
> > DataContext ctxt =
> >
>
BasicServletConfiguration.getDefaultContext(request.getSession());
> > User anUser = (User)
> > ctxt.createAndRegisterNewObject("User");
> > anUser.setName("SomeName");
> > ctxt.commitChanges(Level.WARN);
> > ...
> >
> > throw next "Commit" exception:
> >
> > Caused by: java.sql.SQLException:
> > [Microsoft][SQLServer 2000 Driver for
> > JDBC][SQLServer]Syntax error converting the
> varchar
> > value 'User' to a column of data type int.
> > at
> >
>
com.microsoft.jdbc.base.BaseExceptions.createException(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown
> > Source)
> > at
> >
>
com.microsoft.jdbc.sqlserver.tds.TDSRequest.getRow(Unknown
> > Source)
> > at
> >
>
=== message truncated ===
__________________________________
Discover Yahoo!
Stay in touch with email, IM, photo sharing and more. Check it out!
http://discover.yahoo.com/stayintouch.html
This archive was generated by hypermail 2.0.0 : Wed Jun 08 2005 - 04:02:44 EDT