You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Paul Joseph <pj...@yahoo.com> on 2004/09/19 04:30:42 UTC

how does one use JDO to run ALTER TABLE sql command?

Hi,

My colleague and I are trying to use jdo to do an
"alter table" command.

There don't seem to be any examples showing how this
is done and we are having a bit of a tough time.

The logs show that the right statement is being
executed.

However, the following error is received:
==========================
SQLQUERY: ALTER TABLE array_webtask_usr ADD COLUMN
s_email varchar(100)
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl]
ERROR: SQLException during the execution of the SQL
query: No results were returned by the query.
==========================
Question: how does one alter a table using jdo?

A snippet of our code is as follows:

try {
    String sqlQuery = "ALTER TABLE " + tableName + "
ADD COLUMN " + columnName + " " + dataType + ";";
							System.out.println("Query is" + sqlQuery);
							QueryBySQL querySql = new
QueryBySQL(obj.getClass(), sqlQuery);
							broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
							broker.beginTransaction();
							broker.getObjectByQuery(querySql);
							broker.commitTransaction();
	} catch (Exception e) {
	e.printStackTrace();
	broker.abortTransaction();
	return null;
}




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how does one use JDO to run ALTER TABLE sql command?

Posted by Luca Garulli <l....@gmail.com>.
JDO API doesn't allow schema updating.

If you want to make it, you had to use a direct SQL command.

-- 
bye,
Luca Garulli
www.OrienTechnologies.com

On Sun, 19 Sep 2004 18:09:09 -0700 (PDT), Paul Joseph
<pj...@yahoo.com> wrote:
> hmm...interesting...Thank you for your reply.
> 
> We use JDO a lot in the application but we need the
> ability to alter tables also....it would have been
> nice if JDO could have done it!
> 
> thx
> Paul
> 
> 
> 
> 
> --- Joerg Heinicke <jo...@gmx.de> wrote:
> 
> > On 19.09.2004 04:30, Paul Joseph wrote:
> >
> > > My colleague and I are trying to use jdo to do an
> > > "alter table" command.
> >
> > JDO is an O2R mapper, not a SQL replacement. I would
> > not wonder if it
> > does not work at all. From the error message I guess
> > the query is not
> > pre-tested, but as it does not return a resultset,
> > it fails.
> >
> > There might be a super-duper JDO implementation,
> > that can change the
> > mappings dynamically (as it is needed in your case),
> > but I don't think
> > the reference implementation will do it.
> >
> > Joerg
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail:
> > users-help@cocoon.apache.org
> >
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how does one use JDO to run ALTER TABLE sql command?

Posted by Paul Joseph <pj...@yahoo.com>.
hmm...interesting...Thank you for your reply.

We use JDO a lot in the application but we need the
ability to alter tables also....it would have been
nice if JDO could have done it!

thx
Paul


--- Joerg Heinicke <jo...@gmx.de> wrote:

> On 19.09.2004 04:30, Paul Joseph wrote:
> 
> > My colleague and I are trying to use jdo to do an
> > "alter table" command.
> 
> JDO is an O2R mapper, not a SQL replacement. I would
> not wonder if it 
> does not work at all. From the error message I guess
> the query is not 
> pre-tested, but as it does not return a resultset,
> it fails.
> 
> There might be a super-duper JDO implementation,
> that can change the 
> mappings dynamically (as it is needed in your case),
> but I don't think 
> the reference implementation will do it.
> 
> Joerg
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how does one use JDO to run ALTER TABLE sql command?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 19.09.2004 04:30, Paul Joseph wrote:

> My colleague and I are trying to use jdo to do an
> "alter table" command.

JDO is an O2R mapper, not a SQL replacement. I would not wonder if it 
does not work at all. From the error message I guess the query is not 
pre-tested, but as it does not return a resultset, it fails.

There might be a super-duper JDO implementation, that can change the 
mappings dynamically (as it is needed in your case), but I don't think 
the reference implementation will do it.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how does one use JDO to run ALTER TABLE sql command?

Posted by Paul Joseph <pj...@yahoo.com>.
Thank you for your reply.

I was not able to find an active non-proprietary JDO
list.  

If you know of any, I would be grateful if you could
let me know.

thx
Paul
--- Tony Collen <co...@umn.edu> wrote:

> Paul Joseph wrote:
> > Hi,
> > 
> > My colleague and I are trying to use jdo to do an
> > "alter table" command.
> > 
> > There don't seem to be any examples showing how
> this
> > is done and we are having a bit of a tough time.
> > 
> 
> This isn't the list for it. Best to ask on the JDO
> lists.
> 
> Regards,
> 
> Tony
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how does one use JDO to run ALTER TABLE sql command?

Posted by Tony Collen <co...@umn.edu>.
Paul Joseph wrote:
> Hi,
> 
> My colleague and I are trying to use jdo to do an
> "alter table" command.
> 
> There don't seem to be any examples showing how this
> is done and we are having a bit of a tough time.
> 

This isn't the list for it. Best to ask on the JDO lists.

Regards,

Tony

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org