You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Blake Day <bl...@charter.net> on 2002/04/20 07:33:39 UTC
Extend User Howto Question
While attempting to follow the Extend User Howto, I encountered a problem.
In my application's schema, I have the following:
<table name="CTLG_USER" javaName="CatalogUser" alias="TurbineUser"
baseClass="<package>.catalog.om.TurbineUserAdapter"
basePeer="<package>.catalog.om.TurbineUserPeerAdapter">
<!-- Unique identifier -->
<column name="USER_ID" primaryKey="true" required="true"
type="integer"/>
</table>
<table name="CTLG_SAVED_ITEM" javaName="SavedItem">
<column name="USER_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="PRODUCT_ID" required="true" primaryKey="true" size="16"
type="VARCHAR"/>
<foreign-key foreignTable="CTLG_USER">
<reference local="USER_ID" foreign="USER_ID"/>
</foreign-key>
<foreign-key foreignTable="CTLG_PRODUCT">
<reference local="PRODUCT_ID" foreign="PRODUCT_ID"/>
</foreign-key>
</table>
Unfortunately, the following SQL is generated:
ALTER TABLE CTLG_SAVED_ITEM
ADD CONSTRAINT USER_ID FOREIGN KEY (USER_ID)
REFERENCES CTLG_USER (USER_ID);
I need the SQL to reflect TURBINE_USER as the foreign table, not CTLG_USER.
Does anyone have any suggestions as to why this is happening, and how I
might be able to solve the problem?
Thanks in advance,
Michael Blake Day
Artistry Studios - e-commerce design, implementation and hosting
email: mday@artistrystudios.net
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to paging dabase results
Posted by Kelvin Tan <ke...@relevanz.com>.
Use criteria.setLimit and criteria.setOffset.
I haven't tried it on any other database except MySql, but I don't see why
it shouldn't work. Try it!
Kelvin
----- Original Message -----
From: "贾铁军" <ji...@neusoft.com>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Tuesday, April 23, 2002 1:41 PM
Subject: How to paging dabase results
> Hi,
> I will paging the results from datbase. the first solution is get all of
data from database then deal something(I am using it). however, it will cost
much resource. then I want get a page of data from data every time. I want
to know whether TDK supports limit and offset. as I know, ms sql uses
"select top n * .." and mysql uses "limit m,n", so I want to know limit and
offset works for any database?
> thank you!
>
> Reimon
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
How to paging dabase results
Posted by 贾铁军 <ji...@neusoft.com>.
Hi,
I will paging the results from datbase. the first solution is get all of data from database then deal something(I am using it). however, it will cost much resource. then I want get a page of data from data every time. I want to know whether TDK supports limit and offset. as I know, ms sql uses "select top n * .." and mysql uses "limit m,n", so I want to know limit and offset works for any database?
thank you!
Reimon
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Extend User Howto Question
Posted by Colm McCartan <co...@owl.co.uk>.
At 01:13 23/04/2002 -0400, you wrote:
>Yes, I am using postgres, and I am probably not using the most recent
>postgresql.jar. If you do get a chance, I would appreciate the .jar. I
>assume I'd need to use CVS to grab the version you're using from postgres
>mirrors?
Have sent this offlist...
>Also, what changes do I need to make to db.props to include the BYTEA
>support? I've just changed the VARBINARY line to say "VARBINARY = bytea".
>Is that sufficient?
Theres some good stuff about this in the archive, Michael ;-). Here is a
db.props for postgres from:
http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg06357.html
---------------------------------------------------------------
# Taken from java.sql.Types in the IBM 1.3 JDK
# JDBC to PostgreSQL mappings.
BIT =
TINYINT = int2
SMALLINT = int2
INTEGER = integer
BIGINT = int8
FLOAT = float
REAL = float
BOOLEANCHAR = boolean
DOUBLE =
NUMERIC =
DECIMAL =
CHAR = varchar
VARCHAR = varchar
LONGVARCHAR = bytea
DATE = date
TIME = time
TIMESTAMP = timestamp
BINARY = bytea
VARBINARY = bytea
LONGVARBINARY = bytea
NULL =
OTHER =
JAVA_OBJECT =
DISTINCT =
STRUCT =
ARRAY =
BLOB =
CLOB = text
REF =
---------------------------------------------------------------
Good luck and let us know how you get on...
c
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Extend User Howto Question
Posted by Blake Day <bl...@charter.net>.
Yes, I am using postgres, and I am probably not using the most recent
postgresql.jar. If you do get a chance, I would appreciate the .jar. I
assume I'd need to use CVS to grab the version you're using from postgres
mirrors?
Also, what changes do I need to make to db.props to include the BYTEA
support? I've just changed the VARBINARY line to say "VARBINARY = bytea".
Is that sufficient?
Michael Blake Day
Artistry Studios - e-commerce design, implementation and hosting
email: mday@artistrystudios.net <ma...@artistrystudios.net>
mobile: 770.318.4033
-----Original Message-----
From: Colm McCartan [mailto:colmm@owl.co.uk]
Sent: Monday, April 22, 2002 12:41 PM
To: Turbine Users List
Subject: RE: Extend User Howto Question
At 11:47 22/04/2002 -0400, you wrote:
>I did that also; however, I'm getting that weird exception I've seen
>mentioned (but never publicly resolved) when trying to save a user. It's
>odd in that there are some "noise characters" in the NumberFormatException:
>"??srjava.util.Hashtable?%!J??F
>loadFactorI thresholdxp?@x".
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail:
<ma...@jakarta.apache.org>
Are you using postgres? If so, are you using the most recent postgres.jar
for your driver (7.2b3 works and I can mail it to you if you need it -
last time I checked, it was necessary to build *all* of postgres to get the
most recent jar but there should be a more recent jar on the web by now)
and have you edited the db.props to reflect bytea support?
See:
http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg05715.html
http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg05833.html
hth
c
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Extend User Howto Question
Posted by Colm McCartan <co...@owl.co.uk>.
At 11:47 22/04/2002 -0400, you wrote:
>I did that also; however, I'm getting that weird exception I've seen
>mentioned (but never publicly resolved) when trying to save a user. It's
>odd in that there are some "noise characters" in the NumberFormatException:
>"??srjava.util.Hashtable?%!J??F
>loadFactorI thresholdxp?@x".
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
Are you using postgres? If so, are you using the most recent postgres.jar
for your driver (7.2b3 works and I can mail it to you if you need it -
last time I checked, it was necessary to build *all* of postgres to get the
most recent jar but there should be a more recent jar on the web by now)
and have you edited the db.props to reflect bytea support?
See: http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg05715.html
http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg05833.html
hth
c
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Extend User Howto Question
Posted by Blake Day <bl...@charter.net>.
I did that also; however, I'm getting that weird exception I've seen
mentioned (but never publicly resolved) when trying to save a user. It's
odd in that there are some "noise characters" in the NumberFormatException:
"??srjava.util.Hashtable?%!J??F
loadFactorI thresholdxp?@x".
Here's the exception:
[Mon Apr 22 07:03:00 EDT 2002] -- ERROR -- Turbine.handleException: null
[Mon Apr 22 07:03:00 EDT 2002] -- ERROR --
Exception: java.lang.reflect.InvocationTargetException
Stack Trace follows:
java.lang.reflect.InvocationTargetException:
com.workingdogs.village.DataSetException: Bad conversion:
java.lang.NumberFormatException: ??srjava.util.Hashtable?%!J??F
loadFactorI thresholdxp?@x
at com.workingdogs.village.Value.asInt(Value.java:424)
at
com.workingdogs.village.Value.setPreparedStatementValue(Value.java:233)
at com.workingdogs.village.Record.saveWithInsert(Record.java:325)
at com.workingdogs.village.Record.save(Record.java:185)
at com.workingdogs.village.Record.save(Record.java:166)
at
org.apache.turbine.om.peer.BasePeer.insertOrUpdateRecord(BasePeer.java:860)
at org.apache.turbine.om.peer.BasePeer.doInsert(BasePeer.java:764)
at org.apache.turbine.om.peer.BasePeer.doInsert(BasePeer.java:657)
rethrown as org.apache.turbine.util.security.DataBackendException: Failed to
create account 'email@domain.com': Bad conversion:
java.lang.NumberFormatException: ??srjava.util.Hashtable?%!J??F
loadFactorI thresholdxp?@x
at
org.apache.turbine.services.security.db.DBUserManager.createAccount(DBUserMa
nager.java:404)
at
org.apache.turbine.services.security.BaseSecurityService.addUser(BaseSecurit
yService.java:392)
at
org.apache.turbine.services.security.TurbineSecurity.addUser(TurbineSecurity
.java:430)
at
org.apache.turbine.om.security.TurbineUser.save(TurbineUser.java:680)
at
com.urbanefashion.catalog.modules.actions.Account.doRegister(Account.java:88
)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.turbine.util.velocity.VelocityActionEvent.executeEvents(VelocityA
ctionEvent.java:166)
at
org.apache.turbine.util.velocity.VelocityActionEvent.perform(VelocityActionE
vent.java:114)
at
org.apache.turbine.modules.actions.VelocityAction.perform(VelocityAction.jav
a:114)
at
org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:122)
at
org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:143)
at org.apache.turbine.modules.Page.build(Page.java:90)
at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)
at org.apache.turbine.Turbine.doGet(Turbine.java:447)
at org.apache.turbine.Turbine.doPost(Turbine.java:537)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:255)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:225)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:472)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2252)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
875)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:952)
at java.lang.Thread.run(Thread.java:484)
Michael Blake Day
Artistry Studios - e-commerce design, implementation and hosting
email: mday@artistrystudios.net <ma...@artistrystudios.net>
-----Original Message-----
From: Colm McCartan [mailto:colmm@owl.co.uk]
Sent: Monday, April 22, 2002 5:43 AM
To: Turbine Users List
Subject: Re: Extend User Howto Question
At 01:33 20/04/2002 -0400, you wrote:
>Unfortunately, the following SQL is generated:
>
>ALTER TABLE CTLG_SAVED_ITEM
> ADD CONSTRAINT USER_ID FOREIGN KEY (USER_ID)
> REFERENCES CTLG_USER (USER_ID);
>
>I need the SQL to reflect TURBINE_USER as the foreign table, not CTLG_USER.
>Does anyone have any suggestions as to why this is happening, and how I
>might be able to solve the problem?
I noted this before Michael - see
http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg05399.html
MySQL doesn't seem to mind but postgres will choke.
I simply renamed the foreign-key reference *after* the code had been
generated and manually rebuilt the db - have experienced no problems.
c
................................................................
colm mccartan
panasonic owl uk
colmm@owl.co.uk
(44) 131 561 1035
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Extend User Howto Question
Posted by Colm McCartan <co...@owl.co.uk>.
At 01:33 20/04/2002 -0400, you wrote:
>Unfortunately, the following SQL is generated:
>
>ALTER TABLE CTLG_SAVED_ITEM
> ADD CONSTRAINT USER_ID FOREIGN KEY (USER_ID)
> REFERENCES CTLG_USER (USER_ID);
>
>I need the SQL to reflect TURBINE_USER as the foreign table, not CTLG_USER.
>Does anyone have any suggestions as to why this is happening, and how I
>might be able to solve the problem?
I noted this before Michael - see
http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg05399.html
MySQL doesn't seem to mind but postgres will choke.
I simply renamed the foreign-key reference *after* the code had been
generated and manually rebuilt the db - have experienced no problems.
c
................................................................
colm mccartan
panasonic owl uk
colmm@owl.co.uk
(44) 131 561 1035
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>