hibernate and field symbolic name

Raoul Pierre <[email protected]>
Newsgroups gmane.comp.java.keel.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.