openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: Bug in one-to-many and many-to-one mapping
Date Fri, 08 Jun 2007 01:56:04 GMT
Hi,

I don't see the a field called  cvgsAppenderProperties in the
com.server.dao.config.AppenderConfigDTO class. Are you sure you sent
the same code that you're having problems with?

-Patrick

On 6/6/07, Budigam Srinivas Rao <srinivasrao.budigam@emagia.com> wrote:
>
>
> Hello Patrick,
>
> Please help us in resolving the below problem:
>
> We are having 4 entity files that are inter-related and one dao file,
>
>
>     1. LoggerConfigDTO
>     2. LoggerAppenderMapppingDTO
>     3. AppenderConfigDTO
>     4. AppenderPropertyDTO
>     5. ConfigDAOImpl
>
> The following are the relationships among the four entities :
>
> 1. LoggerConfigDTO
>
>       OneToMany relation with LoggerAppenderMappingDTO
> 2. LoggerAppenderMappingDTO
>
>      ManyToOne Relation with LoggerConfigDTO
>      ManyToOne relation with  AppenderConfigDTO
> 3. AppenderConfigDTO
>
>      OneToMany Relation with LoggerAppenderMappingDTO
>      OneToMany Relation with AppenderPropertyDTO
> 4. AppenderPropertyDTO
>
>         ManyToOne Relation with AppenderConfigDTO
> We have mapped all these relationships with annotations in the DTO files,
> and compiled successfully
>
> The following code snippet that uses entity files
>
>
> 1. public List<LoggerConfig> getLoggerConfigList() throws DaoException {
> 2.        logger.debug("getLoggerConfigList");
> 3.        OpenJPAEntityManager session = null;
> 4.        List<LoggerConfig> configList = new ArrayList<LoggerConfig>();
> 5        try {
> 6            session =
> ServiceLocator.getOpenJPASession("host");
> 7            OpenJPAQuery query = session.createNativeQuery("select * from
> LOGGER_CONFIG where HOST_ID is null",LoggerConfigDTO.class);
> 8            List<LoggerConfigDTO> configDTOs =query.getResultList();
> 9            for (LoggerConfigDTO configDTO : configDTOs) {
> 10                //debug("getLoggerConfigList " + configDTO.toString());
> 11                configList.add(configDTO.toLoggerConfig());
> 12            }
> 13        } catch (Exception e) {
> 14            throw DaoException.getDaoException(e, logger);
> 15        } finally {
> 16            if (session != null && session.isOpen()) {
> 17                session.close();
> 18            }
> 19        }
> 20        return configList;
> 21    }
>
> and while retriving the data in the above code at line number 8 throws the
> following exception.
> Please find the Entity files as an attachement to this mail and following is
> the stack trace that
> is getting displayed on the console. Please help us in resolving this issue.
>
>
> 2007-06-06 19:02:39,008 ERROR
> [com.server.dao.config.hibernate.ConfigDAOImpl] An internal
> error occurred on the Security Server. Refer to cvgs.log and server.log for
> details. Call support if necessary.
> <0.9.7-incubating fatal user error>
> org.apache.openjpa.persistence.ArgumentException: Errors
> encountered while resolving metadata.  See nested exceptions for details.
>  at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:506)
>  at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:288)
>  at
> org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:704)
>  at
> org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:683)
>  at
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:665)
>  at
> org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1483)
>  at
> org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
>  at
> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:219)
>  at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:269)
>  at
> com.server.dao.config.hibernate.ConfigDAOImpl.getLoggerConfigList(ConfigDAOImpl.java:605)
>  at
> com.server.config.ConfigUtil.getLoggerConfigList(ConfigUtil.java:506)
>  at
> com.server.mgmt.ConsoleManagement.getLoggerConfigList(ConsoleManagement.java:591)
>  at
> com.server.mgmt.console.config.LoggerConfigAction.execute(LoggerConfigAction.java:96)
>  at
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
>  at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
>  at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
>  at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> com.server.mgmt.console.access.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>  at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>  at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>  at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>  at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>  at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>  at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>  at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>  at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>  at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>  at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>  at java.lang.Thread.run(Thread.java:803)
> Caused by:
> <0.9.7-incubating fatal user error>
> org.apache.openjpa.persistence.ArgumentException: Field
> "com.server.dao.config.AppenderConfigDTO.cvgsAppenderProperties"
> cannot declare that it is mapped by another field. Its mapping strategy
> (org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy)
> does not support mapping by another field.
>  at
> org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy.assertNotMappedBy(AbstractFieldStrategy.java:59)
>  at
> org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.map(HandlerFieldStrategy.java:70)
>  at
> org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
>  at
> org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
>  at
> org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
>  at
> org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
>  at
> org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:823)
>  at
> org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:319)
>  at
> org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:605)
>  at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:492)
>  ... 40 more
> NestedThrowables:
> java.lang.NullPointerException
>  at
> org.apache.openjpa.jdbc.meta.FieldMapping.initializeMapping(FieldMapping.java:486)
>  at
> org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:405)
>  at
> org.apache.openjpa.jdbc.meta.ClassMapping.initializeMapping(ClassMapping.java:834)
>  at
> org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1590)
>  at
> org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:629)
>  at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:498)
>  at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:288)
>  at
> org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:704)
>  at
> org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:683)
>  at
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:665)
>  at
> org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1483)
>  at
> org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
>  at
> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:219)
>  at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:269)
>  at
> com.server.dao.config.hibernate.ConfigDAOImpl.getLoggerConfigList(ConfigDAOImpl.java:605)
>  at
> com.server.config.ConfigUtil.getLoggerConfigList(ConfigUtil.java:506)
>  at
> com.server.mgmt.ConsoleManagement.getLoggerConfigList(ConsoleManagement.java:591)
>  at
> com.server.mgmt.console.config.LoggerConfigAction.execute(LoggerConfigAction.java:96)
>  at
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
>  at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
>  at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
>  at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> com.server.mgmt.console.access.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>  at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>  at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>  at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>  at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>  at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>  at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>  at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>  at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>  at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>  at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>  at java.lang.Thread.run(Thread.java:803)
> 2007-06-06 19:02:39,019 ERROR [com.server.config.ConfigUtil] Unable to
> obtain list of default loggers.
> com.server.dao.DaoException: An internal error occurred on the Security
> Server. Refer to cvgs.log and server.log for details. Call support if
> necessary.
>  at
> com.server.dao.DaoException.getDaoException(DaoException.java:64)
>  at
> com.server.dao.config.hibernate.ConfigDAOImpl.getLoggerConfigList(ConfigDAOImpl.java:624)
>  at
> com.server.config.ConfigUtil.getLoggerConfigList(ConfigUtil.java:506)
>  at
> com.server.mgmt.ConsoleManagement.getLoggerConfigList(ConsoleManagement.java:591)
>  at
> com.server.mgmt.console.config.LoggerConfigAction.execute(LoggerConfigAction.java:96)
>  at
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
>  at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
>  at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
>  at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> com.server.mgmt.console.access.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>  at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>  at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>  at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>  at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>  at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>  at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>  at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>  at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>  at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>  at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>  at java.lang.Thread.run(Thread.java:803)
> Caused by:
> <0.9.7-incubating fatal user error>
> org.apache.openjpa.persistence.ArgumentException: Errors
> encountered while resolving metadata.  See nested exceptions for details.
>  at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:506)
>  at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:288)
>  at
> org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:704)
>  at
> org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:683)
>  at
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:665)
>  at
> org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1483)
>  at
> org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
>  at
> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:219)
>  at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:269)
>  at
> com.server.dao.config.hibernate.ConfigDAOImpl.getLoggerConfigList(ConfigDAOImpl.java:605)
>  ... 31 more
> Caused by:
> <0.9.7-incubating fatal user error>
> org.apache.openjpa.persistence.ArgumentException: Field
> "com.server.dao.config.AppenderConfigDTO.cvgsAppenderProperties"
> cannot declare that it is mapped by another field. Its mapping strategy
> (org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy)
> does not support mapping by another field.
>  at
> org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy.assertNotMappedBy(AbstractFieldStrategy.java:59)
>  at
> org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.map(HandlerFieldStrategy.java:70)
>  at
> org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
>  at
> org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
>  at
> org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
>  at
> org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
>  at
> org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:823)
>  at
> org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:319)
>  at
> org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:605)
>  at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:492)
>  ... 40 more
>
> Thanks in Advance,
> Srinivas B.
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message