You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Eric Emminger <er...@ericemminger.com> on 2002/11/01 00:54:14 UTC

extend user in TDK 2.2 RC1

Does an updated extend user how-to exist for Turbine 2.2 RC1?

I'm having trouble, namely with an SQLException from the insert-sql task
and some compile errors, both from the init target. If it matters, I'm
actually getting a whole bunch of SQLException errors from the
insert-sql task; it appears to be attempting to drop every individual
entity from the database, but the database is empty because it was
dropped in the create-db task.

Here's the main error from the insert-sql task.
[torque-sql-exec] Failed to execute: ALTER TABLE app_customer ADD
CONSTRAINT app_customer_FK_1 FOREIGN KEY (userId) REFERENCES app_user
(USER_ID)
[torque-sql-exec] java.sql.SQLException: ERROR:  Relation "app_user"
does not exist

Here are the compile errors.
compile:
    [javac] Compiling 80 source files to
/home/eemminger/dev/tdk-2.2-rc1/webapps/app/WEB-INF/classes
    [javac]
/home/eemminger/dev/tdk-2.2-rc1/webapps/app/WEB-INF/src/java/com/company/app/om/BaseCustomer.java:208: operator == cannot be applied to org.apache.torque.om.NumberKey,int
    [javac]                 if (aAppUser != null &&
!(aAppUser.getUserId()==v))
   
[javac]                                                                
^
    [javac]
/home/eemminger/dev/tdk-2.2-rc1/webapps/app/WEB-INF/src/java/com/company/app/om/BaseCustomer.java:526: setUserid(int) in com.company.app.om.BaseCustomer cannot be applied to (org.apache.torque.om.NumberKey)
    [javac]             setUserid(v.getUserId());
    [javac]             ^
    [javac]
/home/eemminger/dev/tdk-2.2-rc1/webapps/app/WEB-INF/src/java/com/company/app/om/BaseAppUserPeer.java:116: cannot resolve symbol
    [javac] symbol  : variable DATABASE_NAME
    [javac] location: class com.company.app.om.BaseAppUserPeer
    [javac]             db = Torque.getConnection(DATABASE_NAME);
    [javac]                                       ^
    [javac]
/home/eemminger/dev/tdk-2.2-rc1/webapps/app/WEB-INF/src/java/com/company/app/om/BaseAppUserPeer.java:161: cannot resolve symbol
    [javac] symbol  : variable DATABASE_NAME
    [javac] location: class com.company.app.om.BaseAppUserPeer
    [javac]            db = Torque.getConnection(DATABASE_NAME);
    [javac]                                      ^
    [javac] 4 errors


Torque appears to be generating incorrect code for the BaseCustomer
object. I believe the cause has something to do with the foreign-key
relationship to the extended user, since this problem goes away when I
remove the relationship.

Also, BaseAppUserPeer is missing the declaration of DATABASE_NAME, which
_does_ exist in the other OM objects.

I suspect some of the configuration properties are incorrect, however, I
don't know which ones.


Included below is some detail on the configuration.

1) updated schema
1.a) project schema
  <table name="app_user" javaName="AppUser" alias="TURBINE_USER"
    baseClass="com.company.app.util.om.TurbineUserAdapter"
    basePeer="org.apache.turbine.om.security.peer.TurbineUserPeer">
    <!-- Unique identifier -->
    <column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
  </table>

1.b) turbine schema - no changes

2) extended TurbineMapBuilder - skipped this as I don't use it and it's
optional

3) extended TurbineUser as TurbineUserAdapter - only implemented
getUserId()
    public NumberKey getUserId() {
        return (NumberKey) getPrimaryKey();
    }

4) extended TurbineUserPeer as TurbineUserPeerAdapter
I tried doing this to see if it would change anything, but it didn't. I
also tried using the default
org.apache.turbine.om.security.peer.TurbineUserPeer.

5) added the retrieveByPK() methods to AppUserPeer

6) changed Fulcrum.properties
services.SecurityService.user.class=com.company.app.om.AppUser
services.SecurityService.userPeer.class=com.company.app.om.AppUserPeer


-- 
Eric Emminger
eric@ericemminger.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: extend user in TDK 2.2 RC1

Posted by Eric Emminger <er...@ericemminger.com>.
I've decided I'm going to use a custom security model instead of Flux,
so you can forget about this post.

Eric

-- 
Eric Emminger
eric@ericemminger.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>