Re: Request for help with new adapter/struts/hibernate
Andreas Kemkes <[email protected]>
| Newsgroups | gmane.comp.java.ejb.middlegen.user |
|---|---|
| Message-ID | <[email protected]> |
Eivind:
>I'm not quite familiar enough with Hibernate to know the best way to look
>up the Factory. So far I've assumed it's deployed as an MBean available
>with JNDI, which I have tested and found to work on JBoss (having deployed
>Hibernate as a SAR file).
>
>
>
I wasn't as much trying to question the scheme that was used as the fact
that the name AirlineHibernateFactory is hard-coded in
hibernate-getSession.vm. The name should be variable.
Also, I've been making a few adjustments due to compiling issues with
the Date data types (I saw the notes in todo.txt), but I'm pretty unsure
whether this is the way to do it.
In hibernate-copyTo.vm:
#if (${column.SqlType} == 91 || ${column.SqlType} == 92) ## 91:
"date" 92: "time"
${persistenceObjectName}.${column.setterName}((java.util.Date)${vo}.${column.getterName}());
#else
${persistenceObjectName}.${column.setterName}(${vo}.${column.getterName}());
#end
and in hibernate-copyFrom.vm:
#if (${column.SqlType} == 91) ## ${column.SqlTypeName} == "date"
${vo}.${column.setterName}(new
java.sql.Date(${persistenceObjectName}.${column.getterName}().getTime()));
#else
#if (${column.SqlType} == 92) ## ${column.SqlTypeName} == "time"
// ${column.SqlTypeName}
${vo}.${column.setterName}(new
java.sql.Time(${persistenceObjectName}.${column.getterName}().getTime()));
#else
${vo}.${column.setterName}(${persistenceObjectName}.${column.getterName}());
#end
#end
This may all be too dependent on the particular SQL database that I'm using.
I've also had issues with foreign keys. Can you please shed some light
on the following comment in delegate.vm:
## IMPLEMENTOR MUST SET THE VARIABLE retPersistenceClass IN THEIR IMPL
Andreas
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click