Hi Dain,

Why not use a sequential alias with no meaning, and let the user 
specify a single global unique postfix in a config file if necessary 
(e.g. "t1", "t2", "t3", and the user can make this "t1_myunique", 
"t2_myunique", "t3_myunique")?

-Dan

On 26 Aug 01, at 23:50, Dain Sundstrom wrote:

> David,
> 
> I need create aliases when a table is used more then once in a EJB-QL query.
> It is really easy to get into this situation, so aliases are always used.  I
> could let the db compain, but then  the user would have no recourse, as
> EJB-QL is currently the only way to define an ejbSelect. I looked at the
> getSQLKeywords function, and I think it is a good start.  We will still need
> the ability to specify additional keywords, because the drivers sometimes
> lie.
> 
> Does this explain the issue more? This is only for EJB-QL, but could be
> expanded to other auto-generation code like table and column name
> generation.
> 
> I have been thinking that this code should be moved back into the jdbc
> connector object... but that is for another day.
> 
> -dain
> 
> ----- Original Message -----
> From: "David Jencks" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, August 26, 2001 11:20 PM
> Subject: Re: [JBoss-dev] SQL reserved words
> 
> 
> > Probably I don't understand all the issues here,
> >
> >
> > Why not just use the fully qualified column name relation_name.column_name
> > always and dispense with aliases?  You can't use a reserved word for a
> > relation_name anyway, so you don't really need to worry about keeping
> track
> > of them... the db will complain.
> >
> > If you do want to keep track of reserved words, there is a database
> > metadata method getSQLKeywords that might be helpful.
> >
> > david jencks
> >
> > On 2001.08.26 17:52:35 -0400 Dain Sundstrom wrote:
> > > Hi all,
> > >
> > > I have been thinking over the issue of generation of table aliases in
> > > EJB-QL
> > > queries, and have run into some problems.  What I want to do is prevent
> > > the
> > > EQL-QL assembler from generating table aliases that have been already
> > > used,
> > > that are reserved words, or are a db object name (i.e., a table, view,
> or
> > > other name).  I can handle the first to easily, but I can't think of a
> > > way
> > > to prevent collision with db objects.
> > >
> > > We could just tell users that they can prevent the code from generating
> > > an
> > > alias that is the name of a db object by adding the name to a reserved
> > > word
> > > list in the config file.  I think this is reasonable as long as it is
> > > rare.
> > >
> > > Then there is the issue of generating a database alias that it the same
> > > as
> > > an auto generated table name.  This can happen because there is no
> > > central
> > > repository for the reserved word list. Let me explain the last claim a
> > > little more.  I am proposing adding a reserved word list to the
> > > type-mapping
> > > section section of the config file.  The type mapping is selectable on a
> > > per
> > > bean level (newer feature).  This means that each bean effectively has
> > > it's
> > > own datasource mapping information, and no central repository.
> > >
> > > Again, I think the only way around this is to have the user hand assign
> > > the
> > > table name and if collision persists add the table name to the reserved
> > > list.
> > >
> > > I just don't like the idea of forcing users to do a lot of hand
> > > configuration of the data mapping.  I think the system should basically
> > > work
> > > without any jboss specific configuration of the cmp engine.
> > >
> > > If you have any insight into this issue, please speak-up.
> > >
> > > -dain
> > >
> > >
> > > _______________________________________________
> > > Jboss-development mailing list
> > > [EMAIL PROTECTED]
> > > http://lists.sourceforge.net/lists/listinfo/jboss-development
> > >
> > >
> >
> > _______________________________________________
> > Jboss-development mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-development
> >
> 
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development



_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to