About my previous post, I'm using HSQLDB, so tables and variables should
be returned in upper case, even though the ddl I pasted down there is in
lower case. Besides HSQLDB,
actionlayer.plugin=struts
persistencelayer.plugin=hibernate

I think my problem is in the many2many element, but I can't figure out
what is it. Can somebody take 1 minute to look at it? I believe it is a
siple thing for experienced eyes.

Thanks,
Diego


Diego Ballve wrote:
> Hello,
> 
> I'm trying to use middlegen in a database w/ multiple many-to-many and
> I'm getting StrutsXXXDelegate to call undefined methods like
> TranslatorUtil.copyPersistenceToVo(Collection, XXXForm);
> 
> For instance, I have defined
>          <many2many>
>             <tablea generate="true" name="ACCOUNT" />
>             <jointable name="ACCOUNT_CREDENTIALS" generate="false" />
>             <tableb generate="true" name="CREDENTIALS" />
>          </many2many>
> 
> For my database definiton:
> 
> create table credentials (
>    id varchar(255) not null,
>    primary key (id)
> )
> create table account (
>    id varchar(255) not null,
>    password varchar(255),
>    expiration_time bigint,
>    owner varchar(255) not null,
>    primary key (id)
> )
> create table account_credentials (
>    account_id varchar(255) not null,
>    credential_id varchar(255) not null,
>    primary key (credential_id, account_id)
> )
> alter table account_credentials add constraint FK10022FEAA77C1603
> foreign key (credential_id) references credentials
> alter table account_credentials add constraint FK10022FEAD01E1C6D
> foreign key (account_id) references account
> 
> 
> But I get middlegen generating
> 
> public class StrutsAccountDelegate {
> ...
>    /**
>     * This method will return all objects referenced by Credential
>     */
>    public static List getCredential(airline.web.struts.AccountForm
> accountForm) throws Exception {
>       List retVals = new ArrayList();
>       airline.hibernate.Account accountPersistence = null;
> javax.naming.InitialContext ctx = new javax.naming.InitialContext();
> // TODO: Make adapter get SessionFactory jndi name by ant task argument?
> net.sf.hibernate.SessionFactory factory =
> (net.sf.hibernate.SessionFactory)ctx.lookup("java:AirlineHibernateFactory");
> net.sf.hibernate.Session session = factory.openSession();
> net.sf.hibernate.Transaction tx = session.beginTransaction();
> accountPersistence =
> (airline.hibernate.Account)session.load(airline.hibernate.Account.class,
> accountPersistence.getId());
> tx.commit();
> session.close();
> retVals.add(accountPersistence.getCredentials());
>       ArrayList CREDENTIAL_ID_vos = new ArrayList();
>       for (Iterator it = retVals.iterator(); it.hasNext(); ) {
>          airline.web.struts.CredentialForm CREDENTIAL_ID_Temp = new
> airline.web.struts.CredentialForm();
>          java.util.Collection CREDENTIAL_ID_PO =
> (java.util.Collection)it.next();
>          TranslatorUtil.copyPersistenceToVo(CREDENTIAL_ID_PO,
> CREDENTIAL_ID_Temp);
>          CREDENTIAL_ID_vos.add(CREDENTIAL_ID_Temp);
>       }
>       retVals = CREDENTIAL_ID_vos;
>       return retVals;
>     }
> }
> 
> It seems that middlegen is mapping the collection and not the collection
> items.. I've spend some time trying to figure out why but I'm stuck!
> what am I missing?
> 
> Thanks,
> Diego
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: New Crystal Reports XI.
> Version 11 adds new functionality designed to reduce time involved in
> creating, integrating, and deploying reporting solutions. Free runtime info,
> new features, or free trial, at: http://www.businessobjects.com/devxi/728
> _______________________________________________
> middlegen-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/middlegen-user
> 
> 



-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
middlegen-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/middlegen-user

Reply via email to