Re: hibernate and field symbolic name
Aleksandar Vidakovic <[email protected]>
| Newsgroups | gmane.comp.java.keel.devel |
|---|---|
| Message-ID | <1113749014.20605.6.camel@popper> |
Raoul,
currently I'm working on an update for svc-persist-hibernate... mainly
to keep it in sync with hibernate 3.0; but internally the service
changed (almost) completely. I hope to get it done by tonight, but right
now I have to take a coffee in a bar ;-) , because I'm struggling for
some hours with the programmatical configuration of hibernate
(org.hibernate.mapping especially). I cleaned up a lot, so I hope that
things are easier to understand (especially the variaous hibernate
parameters that you can pass to fields).
Cheers,
Aleks
On Sun, 2005-04-17 at 13:40 +0200, Raoul Pierre wrote:
> Hello,
>
> Does the symbolic name of a field have to be the name of the class
> attribut? At least with Hibernate?
>
> With svc-persist-default I have no problem with something like:
>
> /**
> * Payroll Person
> *
> * A Person is a individual entity, with only permanent data
> *
> * @persist.persistent
> * schema="payroll"
> * name="PN_person"
> * descrip="Persistent person"
> * table="T_person"
> *
> */
> public class Person {
> [...]
> /**
> *
> * @persist.field
> * name="PF_personId"
> * db-name="personId"
> * read-only="true"
> * type="integer"
> * primary-key="true"
> * null-allowed="false"
> * descrip="Person record Id"
> * auto-increment="identity"
> *
> * @return Person record identifier
> */
> public Integer getPersonId() {
> return personId;
> }
>
> where the symbolic name is neither the atttribut name nor the DB field name.
>
> But with sve-persist-hibernate I got (in system.log):
>
> ERROR 2005-04-17 01:41:42.042 [system.command]
> (/org.apache.avalon.fortress.util.FortressCommandFailureHandler.handleCommandFailure(FortressCommandFailureHandler.java:57)
> ): Could not prepare ComponentHandler for:
> org.keel.services.persist.hibernate.HibernatePersistentFactory
> org.keel.services.persist.PersistenceException: Bean
> 'org.popsuite.payroll.entities.Person' does not have a property matching
> 'PF_personId'
> at
> org.keel.services.persist.hibernate.HibernatePersistentFactory.propertyName(HibernatePersistentFactory.java:672)
> at
> org.keel.services.persist.hibernate.HibernatePersistentFactory.initialize(HibernatePersistentFactory.java:195)
> at
> org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil.java:283)
> at
> org.apache.avalon.fortress.impl.handler.ComponentFactory.newInstance(ComponentFactory.java:184)
> at
> org.apache.avalon.fortress.impl.factory.ProxyObjectFactory.newInstance(ProxyObjectFactory.java:54)
> at
> org.apache.avalon.fortress.impl.handler.AbstractComponentHandler.newComponent(AbstractComponentHandler.java:246)
> at
> org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler.doPrepare(ThreadSafeComponentHandler.java:40)
> at
> org.apache.avalon.fortress.impl.handler.AbstractComponentHandler.prepareHandler(AbstractComponentHandler.java:147)
> at
> org.apache.avalon.fortress.impl.handler.LEAwareComponentHandler.prepareHandler(LEAwareComponentHandler.java:85)
> at
> org.apache.avalon.fortress.impl.handler.PrepareHandlerCommand.execute(PrepareHandlerCommand.java:66)
> at
> org.d_haven.event.command.CommandEventHandler.handleEvent(CommandEventHandler.java:105)
> at
> org.d_haven.event.impl.AbstractEventHandler.handleEvents(AbstractEventHandler.java:30)
> at
> org.d_haven.event.command.EventPipelineRunner.run(EventPipelineRunner.java:93)
> at
> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
> at java.lang.Thread.run(Thread.java:534)
>
> In fact initialize function gives the symbolic name as argument to the
> propertyName function. And this last one compares this argument with the
> names of the class attributs not with with the associated symbolic names.
>
> Is it at purpose?
>
> Pierre
>
>
> http://keelframework.org/documentation.shtml
> Keelgroup mailing list
> [email protected]
> http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
>
--
Aleksandar Vidakovic <[email protected]>
http://keelframework.org/documentation.shtml
Keelgroup mailing list
[email protected]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com