Andrus,
I have opened CAY-1168 for issue #1.
Regarding #2, I tried to use quotes in the modeler but it continues behaving weird when creating an ObjEntity from such attributes, and throwing the exception when validating... and if I create the ObjEntity without dot, and then change its attribute to dot with quotes, validating gives warnings for invalid character " ` " and " . "
Btw, I need the dots for integration with other system, not for pleasure ;-)
Javier
> From: andru..bjectstyle.org
> To: use..ayenne.apache.org
> Subject: Re: Modeler Exception for using dots on attributes
> Date: Tue, 13 Jan 2009 18:44:37 +0200
>
> Hi Javier,
>
> This is definitely a limitation, and as you've discovered, there are 2
> issues here.
>
> 1. Dot is a standard path separator in Cayenne (you are the first one
> in so many years of Cayenne who has dots in column names; I am not
> saying this is illegal, rather that nobody in the community has done
> it before). So looks like we'll need to have some internal escaping of
> dots invisible to the user. May not be too hard to implement (?)
>
> 2. Quoting identifiers. This is something that we were going to do for
> some time, but never got around to actually doing it (we have a few
> Jiras on it).
>
> There is a workaround for #2 - use quotes in the modeler for the
> attribute names. There's no workaround for #1, and this is a bug IMO
> (and as I said, hopefully not a hard one to fix). If you can open a
> Jira on that, I'd appreciate it. If not, I can do it myself.
>
> Thanks,
> Andrus
>
>
>
> On Jan 13, 2009, at 6:21 PM, Javi Peter wrote:
> >
> > Hi again,
> >
> > I´ve been doing some debugging and I think I have found the root of
> > the problem. In order to do the following debugs I had to edit the
> > mapping file manually (because the modeler hangs).
> >
> > We have to take into account that a query statement for a column
> > "mail.host" of the table "account" like "SELECT t0.mail.host,
> > t0.others FROM account t0" will fail, and it must be queried like
> > "SELECT t0.`mail.host`, t0.others FROM account t0".
> >
> > I launched a simple test and it failed with this exception:
> >
> > INFO QueryLogger: *** error.
> > org.apache.cayenne.exp.ExpressionException: [v.2.0.4 October 8 2007]
> > Can't resolve path component: [account.mail].
> > at org.apache.cayenne.map.Entity$PathIterator.next(Entity.java:363)
> > at
> > org
> > .apache
> > .cayenne
> > .access
> > .trans.SelectTranslator.appendQueryColumns(SelectTranslator.java:377)
> > at
> > org
> > .apache
> > .cayenne
> > .access
> > .trans.SelectTranslator.buildResultColumns(SelectTranslator.java:338)
> > at
> > org
> > .apache
> > .cayenne
> > .access.trans.SelectTranslator.createSqlString(SelectTranslator.java:
> > 113)
> > at
> > org
> > .apache
> > .cayenne
> > .dba
> > .mysql
> > .MySQLSelectTranslator.createSqlString(MySQLSelectTranslator.java:31)
> > at
> > org
> > .apache
> > .cayenne
> > .access.trans.QueryAssembler.createStatement(QueryAssembler.java:95)
> > [...]
> >
> > The problem there was a StringTokenizer in
> > org.apache.cayenne.map.Entity (line 331) which in method next()
> > thinks that the dot of "mail.host" is another token so it treats it
> > like two attributes instead of one. Changing manually the variable
> > on debug mode and changing back again after the tokenizer, it
> > finally forms the SQL statement, but the bad one, so again we get an
> > exception:
> >
> > com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column
> > 't0.mail.host' in 'field list'
> > at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026)
> > at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
> > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
> > at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
> > at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
> > at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
> > at
> > com
> > .mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:
> > 1761)
> > [..]
> >
> > A search for the root of this exception lead me to
> > org.apache.cayenne.access.trans.SelectTranslator, where the
> > ArrayList "colums" gets filled and there it is the ColumnDescriptor
> > for our column, and the qualifiedColumnName is "t0.mail.host", which
> > of course won´t work. Changing it to "t0.`mail.host`" builds the
> > correct SELECT statement and finally works.
> >
> > Is this a bug or am I missing something?
> > Javier Rubio
> >
> >
> >> From: javipete..otmail.com
> >> To: use..ayenne.apache.org
> >> Subject: RE: Modeler Exception for using dots on attributes
> >> Date: Tue, 13 Jan 2009 09:07:09 +0100
> >>
> >>
> >> Sure: "account" is the table, "mail.imap.minidletime" is the column
> >> name.
> >>
> >> Thanks in advance
> >> Javier
> >>
> >>> From: andru..bjectstyle.org
> >>> To: use..ayenne.apache.org
> >>> Subject: Re: Modeler Exception for using dots on attributes
> >>> Date: Mon, 12 Jan 2009 19:32:08 +0200
> >>>
> >>> So "account.mail" is a COLUMN name? Not a table + column name?
> >>>
> >>> Could you clarify please.
> >>>
> >>> Thanks,
> >>> Andrus
> >>>
> >>>
> >>> On Jan 12, 2009, at 7:10 PM, Javi Peter wrote:
> >>>
> >>>>
> >>>> Hi,
> >>>>
> >>>> each time I reverse engineer a database schema with dots (e.g.
> >>>> "mail.account"), the modeler hangs. If I hit Validate Project, it
> >>>> shows the exception shown at the end of the email.
> >>>> It also happens if I create manually the ObjAttribute.
> >>>>
> >>>> Any ideas of why this happens and how to workaround this (I MUST
> >>>> use
> >>>> dots).
> >>>>
> >>>> Thanks,
> >>>> Javier Rubio
> >>>>
> >>>>
> >>>> CayenneModeler Info
> >>>> Version: 2.0.4
> >>>> Build Date: October 8 2007
> >>>> Exception:
> >>>> =================================
> >>>> org.apache.cayenne.exp.ExpressionException: [v.2.0.4 October 8
> >>>> 2007]
> >>>> Can't resolve path component: [account.mail].
> >>>> at org.apache.cayenne.map.Entity$PathIterator.next(Entity.java:
> >>>> 363)
> >>>> at
> >>>> org
> >>>> .apache.cayenne.map.ObjAttribute.getDbAttribute(ObjAttribute.java:
> >>>> 147)
> >>>> at
> >>>> org
> >>>> .apache
> >>>> .cayenne
> >>>> .util.EntityMergeSupport.getMeaningfulFKs(EntityMergeSupport.java:
> >>>> 173)
> >>>> at
> >>>> org
> >>>> .apache
> >>>> .cayenne
> >>>> .modeler
> >>>> .dialog
> >>>> .objentity
> >>>> .EntitySyncController.createMerger(EntitySyncController.java:69)
> >>>> at
> >>>> org
> >>>> .apache
> >>>> .cayenne
> >>>> .modeler
> >>>> .action.DbEntitySyncAction.synchDbEntity(DbEntitySyncAction.java:
> >>>> 75)
> >>>> at
> >>>> org
> >>>> .apache
> >>>> .cayenne
> >>>> .modeler
> >>>> .action.DbEntitySyncAction.performAction(DbEntitySyncAction.java:
> >>>> 60)
> >>>> at
> >>>> org
> >>>> .apache
> >>>> .cayenne
> >>>> .modeler.util.CayenneAction.actionPerformed(CayenneAction.java:163)
> >>>> at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
> >>>> at javax.swing.AbstractButton$Handler.actionPerformed(Unknown
> >>>> Source)
> >>>> at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
> >>>> Source)
> >>>> at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
> >>>> at
> >>>> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
> >>>> Source)
> >>>> at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
> >>>> at java.awt.Component.processMouseEvent(Unknown Source)
> >>>> at javax.swing.JComponent.processMouseEvent(Unknown Source)
> >>>> at java.awt.Component.processEvent(Unknown Source)
> >>>> at java.awt.Container.processEvent(Unknown Source)
> >>>> at java.awt.Component.dispatchEventImpl(Unknown Source)
> >>>> at java.awt.Container.dispatchEventImpl(Unknown Source)
> >>>> at java.awt.Component.dispatchEvent(Unknown Source)
> >>>> at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown
> >>>> Source)
> >>>> at java.awt.LightweightDispatcher.processMouseEvent(Unknown
> >>>> Source)
> >>>> at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
> >>>> at java.awt.Container.dispatchEventImpl(Unknown Source)
> >>>> at java.awt.Window.dispatchEventImpl(Unknown Source)
> >>>> at java.awt.Component.dispatchEvent(Unknown Source)
> >>>> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> >>>> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
> >>>> Source)
> >>>> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
> >>>> Source)
> >>>> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> >>>> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> >>>> at java.awt.EventDispatchThread.run(Unknown Source)
> >>>>
> >>>>
> >>>> _________________________________________________________________
> >>>> Descubre todas las formas en que puedes estar en contacto con
> >>>> amigos
> >>>> y familiares.
> >>>> http://www.microsoft.com/windows/windowslive/default.aspx
> >>>
> >>
> >> _________________________________________________________________
> >> Chatea sin límites en Messenger con la tarifa plana de Orange
> >> http://serviciosmoviles.es.msn.com/messenger/orange.aspx
> >
> > _________________________________________________________________
> > ¿Quieres ver los mejores videos de MSN? Enciende Messenger TV
> > http://messengertv.msn.com/mkt/es-es/default.htm
>
_________________________________________________________________
Nuevo Windows Live, un mundo lleno de posibilidades. Descúbrelo.
http://www.microsoft.com/windows/windowslive/default.aspx
This archive was generated by hypermail 2.0.0 : Tue Jan 13 2009 - 12:49:11 EST