TableGenerator failing to release the connection could lead to connection leak in secondary pool
4
Version: datanucleus-rdbms 5.2.10 Stacktrace: NestedThrowablesStackTrace: Deadlock found when trying to get lock; try restarting transaction org.datanucleus.exceptions.NucleusDataStoreException: Deadlock found when trying to get lock; try restarting transaction at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.release(ConnectionFactoryImpl.java:362) at org.datanucleus.store.rdbms.RDBMSStoreManager$1.releaseConnection(RDBMSStoreManager.java:2022) at org.datanucleus.store.rdbms.valuegenerator.TableGenerator.obtainGenerationBlock(TableGenerator.java:404) ... Caused by: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:115) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:113) at com.mysql.cj.jdbc.ConnectionImpl.commit(ConnectionImpl.java:839) at com.zaxxer.hikari.pool.ProxyConnection.commit(ProxyConnection.java:353) at com.zaxxer.hikari.pool.HikariProxyConnection.commit(HikariProxyConnection.java) at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.release(ConnectionFactoryImpl.java:357) ... 44 more If an exception is happening on committing the connection, call on super.release() on the ConnectionFactoryImpl$ManagedConnectionImpl.release is ignored, this could be result to connection leak on the secondary pool. Checked the latest code, sounds like still be a problem: https://github.com/datanucleus/datanucleus-rdbms/blob/master/src/main/java/org/datanucleus/store/rdbms/ConnectionFactoryImpl.java#L362 Question: Are there some ways to close these leaking connections if that happen or to avoid the problem? Thank you!
|
Side-effects of setting datanucleus.connectionFactory and datanucleus.connectionFactory2 to the same DataSource?
2
We currently have a connection pool (HikariCP) per DataNucleus ConnectionFactory. I'm trying to figure out if we can avoid this overhead by simply re-using the same HikariCP DataSource for both the primary and secondary ConnectionFactory. From initial testing I can't observe any obvious issues with that approach, and the docs don't explicitly mention a need to use separate DataSources. Is there anything I'm overlooking? Would it be problematic to use the same DataSource as shown below? final DataSource dataSource = createPooledDataSource(); dnProps.put(PropertyNames.PROPERTY_CONNECTION_FACTORY, dataSource); dnProps.put(PropertyNames.PROPERTY_CONNECTION_FACTORY2, dataSource); // ... PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(dnProps, "MyApp");
|
Fetch groups causes n+1 issue when 3 tables are involved
Hello, I've observed some arguably weird behaviour when there is a 3 level dependency (don't know what to call it) between tables, more specifically: Class Inventory has: @Persistent(defaultFetchGroup = "true") Set<Product> products = new HashSet<>(); Class Product has: @Persistent(defaultFetchGroup = "true") Set<Part> parts = new HashSet<>();; When retrieving data: Query<Inventory> query = pm.newQuery(Inventory.class); List<Inventory> inventories = (List<Inventory>) query.execute(); System.out.println("\nStarting detach copy all..."); pm.getFetchPlan().setMaxFetchDepth(-1); pm.detachCopyAll(inventories); System.out.println("\nEnded detach copy all..."); // more code here... Between the 2 "detach copy" logs I can see n+1 queries being done: 17:32:09,453 [DEBUG] SELECT 'com.test.datanucelus.entity.tutorial.Inventory' AS `DN_TYPE`,`A0`.`NAME` FROM `INVENTORY` `A0` 17:32:09,463 [DEBUG] SELECT 'com.test.datanucelus.entity.tutorial.Product' AS `DN_TYPE`,`A0`.`DESCRIPTION`,`A0`.`ID`,`A0`.`NAME`,`A0`.`PRICE`,`A0`.`PRODUCTS_NAME_OWN` FROM `PRODUCT` `A0` WHERE EXISTS (SELECT 'com.test.datanucelus.entity.tutorial.Inventory' AS `DN_TYPE`,`A0_SUB`.`NAME` AS `DN_APPID` FROM `INVENTORY` `A0_SUB` WHERE `A0`.`PRODUCTS_NAME_OWN` = `A0_SUB`.`NAME`) Starting detach copy all... 17:32:09,526 [DEBUG] SELECT 'com.test.datanucelus.entity.tutorial.Part' AS `DN_TYPE`,`A0`.`ID`,`A0`.`NAME` FROM `PART` `A0` WHERE `A0`.`PARTS_ID_OWN` = <53> 17:32:09,543 [DEBUG] SELECT 'com.test.datanucelus.entity.tutorial.Part' AS `DN_TYPE`,`A0`.`ID`,`A0`.`NAME` FROM `PART` `A0` WHERE `A0`.`PARTS_ID_OWN` = <51> 17:32:09,557 [DEBUG] SELECT 'com.test.datanucelus.entity.tutorial.Part' AS `DN_TYPE`,`A0`.`ID`,`A0`.`NAME` FROM `PART` `A0` WHERE `A0`.`PARTS_ID_OWN` = <52> //more logs here... I have attached a sample project that reproduces the behaviour. Not sure if this is me not understanding the tool correctly, a bug or a limitation, could someone please advise, if you have the time? Thanks
|
Racing condition in compiling queries after upgrading from 5.0.x to 5.2.x
10
Hello, We have recently upgraded Datanucleus from 5.0 to 5.2 and we started to see broken queries, here are some examples: # this query is cut after the WHERE cause SELECT 'com.somepackage.EntityOne' AS `dn_type`, `a0`.`creationdate`, `a0`.`encodedkey`, `a0`.`NAME`, `a0`.`entityone_encodedkey_own` FROM `entityone` `a0` WHERE # this query have multiple issues: some parts are duplicated (see the first line), some nulls appear in the field list SELECT 'com.somepackage.AnotherEntity''com.somepackage.AnotherEntity' AS `dn_type`,, `a0`.`active`, `a0`.`amount`, nullnullnullnullnullnull, `a0`.`id`, `a0`.`lastmodifieddate`, `a0`.`NAME`, `a0`.`TRIGGER`, `a0`.`anotherentity_encodedkey_own`, `a0`.`anotherentity_integer_idx` AS `nucorder0` FROM `anotherentity` `a0` ... The issues only heappens when loading the one to many relations. We haven't been able to reproduce the issue so far, it only happens in some of the production environments. To me this looks like a racing condition in compiling the SQL queries, probably in org.datanucleus.store.rdbms.sql.SelectStatement#getSQLText. This method was a synchronized method in 5.0 but the synchronized keyword has been removed in 5.2 in this commit https://github.com/datanucleus/datanucleus-rdbms/commit/548e18d6babcddf2271a2bba312139eb58f2d742#diff-9b826f96d7e6dcf962322355800d231eb1c8b8cabe5bb5047921b28209c7c4e2. Have anyone encountered such an issues? Do you have any ideas on what we might be doing wrong? Any help will be much appreciated. Thanks, Marius
|
Deserialized object is of a class that is part of a dynamically loaded jar via URLClassLoader and so DN deserialization fails with ClassNotFound
2
I am loading a persistent class that has an attribute which is stored as a (Java) serialized SCO - stock standard DN stuff that I've been using for many years. However, in this case the serialized object is of a class which is part of a dynamically loaded jar via a URLClassLoader that I have configured. I have already set up DN to use this URL class loader and it successfully stores/retrieves FCO objects without a problem. However, when a FCO has a serialized SCO as an attribute the deserialization of that, as seen when I look at the stack trace, uses Java's stock standard Java deserializer (ObjectInputStream) which, of course, does not use my dynamically created URLClassLoader and so it can't find the SCO class. I can see an example where the serializer can be customized to Kryo by installing a TypeConverter but I don't really need/want to implement a whole TypeConverter as I'm happy with the default conversions. All I need it to be able to specify a different instance of ObjectInputStream to use when deserializing i.e. one where I have overridden resolveClass() method to use my dynamically set up URLClassLoader to load the class. Is something like that possible via configuration or coding somewhere in DN?
|
Should/when should an entity implement Comparable, and what should that implementation be?
3
qn 1. should an entity implement `Comparable`? For consistency/sanity, I would imagine it should, but if an object never in a one-to-many or many-to-many, then does it really matter if it doesn't implement `Comparable`? qn 2: if it does should the implementation be same as (one of) the `@Unique` constraints. Again, for consistency/sanity, presumably it should. But if the entity only appears as a child in the `SortedSet` of its parent, then every child object will have the same parent, and so presumably there's no need to compare the parent reference in the comparable impl? This short-cutting could also be a performance win, because otherwise, to evaluate the parent's would cause their own `Comparable` to be evaluated, which could cause a cascade of resolving referenced objects. An ArchUnit rule could perhaps be implemented to check that the invariant (the child is only ever referenced by its parent) is not violated. Thoughts? PS: what got us into this is a possible bug in DN 6.x with cascading delete of children (dependent=true) ... the `RelationshipManagerImpl` iterates over all children before deleting them, which causes the children to be sorted and thus their `compareTo` to be called. We found that the call to `getParent()` within that `compareTo` returned `null` first time, and then the actual reference second time... our work-around is to just call the getter twice, but simply not calling it would be an alternative workaround.
|
java.sql.SQLException: IJ031019: You cannot commit during a managed transaction
7
Datanucleus JCA adapter trying to commit TX during managed TX during initialization . https://github.com/urbandroid/jdottest https://github.com/urbandroid/datanucleus-jdo-jca My guess is that Schema creation is not suitable to run on Managed TX but i'm not sure. 18:39:02,813 ERROR [stderr] (default task-3) NestedThrowablesStackTrace: 18:39:02,813 ERROR [stderr] (default task-3) java.sql.SQLException: IJ031019: You cannot commit during a managed transaction 18:39:02,813 ERROR [stderr] (default task-3) at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:1063) 18:39:02,813 ERROR [stderr] (default task-3) at org.jboss.jca.adapters.jdbc.WrappedConnection.commit(WrappedConnection.java:834) 18:39:02,813 ERROR [stderr] (default task-3) at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.release(ConnectionFactoryImpl.java:339) 18:39:02,813 ERROR [stderr] (default task-3) at org.datanucleus.store.rdbms.RDBMSStoreManager.<init>(RDBMSStoreManager.java:398) 18:39:02,814 ERROR [stderr] (default task-3) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 18:39:02,814 ERROR [stderr] (default task-3) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 18:39:02,829 ERROR [stderr] (default task-3) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 18:39:02,829 ERROR [stderr] (default task-3) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 18:39:02,830 ERROR [stderr] (default task-3) at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:606) 18:39:02,830 ERROR [stderr] (default task-3) at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:301) 18:39:02,830 ERROR [stderr] (default task-3) at org.datanucleus.NucleusContextHelper.createStoreManagerForProperties(NucleusContextHelper.java:133) 18:39:02,830 ERROR [stderr] (default task-3) at org.datanucleus.PersistenceNucleusContextImpl.initialise(PersistenceNucleusContextImpl.java:420) 18:39:02,830 ERROR [stderr] (default task-3) at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:821) 18:39:02,830 ERROR [stderr] (default task-3) at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManager(JDOPersistenceManagerFactory.java:865) 18:39:02,831 ERROR [stderr] (default task-3) at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManager(JDOPersistenceManagerFactory.java:848) 18:39:02,831 ERROR [stderr] (default task-3) at org.datanucleus.jdo.connector.ManagedConnectionImpl.getPersistenceManager(ManagedConnectionImpl.java:192) 18:39:02,831 ERROR [stderr] (default task-3) at org.datanucleus.jdo.connector.ConnectionXAResource.start(ConnectionXAResource.java:202) 18:39:02,831 ERROR [stderr] (default task-3) at org.jboss.jca.core.tx.jbossts.XAResourceWrapperImpl.start(XAResourceWrapperImpl.java:215) 18:39:02,831 ERROR [stderr] (default task-3) at org.jboss.jca.core.tx.jbossts.XAResourceWrapperStatImpl.start(XAResourceWrapperStatImpl.java:176) 18:39:02,831 ERROR [stderr] (default task-3) at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:662) 18:39:02,831 ERROR [stderr] (default task-3) at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:423) 18:39:02,831 ERROR [stderr] (default task-3) at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener$TransactionSynchronization.enlist(TxConnectionListener.java:986) 18:39:02,831 ERROR [stderr] (default task-3) at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:379) 18:39:02,832 ERROR [stderr] (default task-3) at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:553) 18:39:02,832 ERROR [stderr] (default task-3) at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:928) 18:39:02,832 ERROR [stderr] (default task-3) at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:750) 18:39:02,832 ERROR [stderr] (default task-3) at org.datanucleus.jdo.connector.PersistenceManagerFactoryImpl.getConnection(PersistenceManagerFactoryImpl.java:87) 18:39:02,832 ERROR [stderr] (default task-3) at org.datanucleus.jdo.connector.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:110) 18:39:02,832 ERROR [stderr] (default task-3) at com.airhacks.PersistenceResource.getPersistenceManager(PersistenceResource.java:46) 18:39:02,832 ERROR [stderr] (default task-3) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 18:39:02,832 ERROR [stderr] (default task-3) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 18:39:02,833 ERROR [stderr] (default task-3) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 18:39:02,833 ERROR [stderr] (default task-3) at java.lang.reflect.Method.invoke(Method.java:498) 18:39:02,833 ERROR [stderr] (default task-3) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88) 18:39:02,833 ERROR [stderr] (default task-3) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78) 18:39:02,833 ERROR [stderr] (default task-3) at org.jboss.weld.injection.producer.ProducerMethodProducer.produce(ProducerMethodProducer.java:100) 18:39:02,833 ERROR [stderr] (default task-3) at org.jboss.weld.injection.producer.AbstractMemberProducer.produce(AbstractMemberProducer.java:161) 18:39:02,833 ERROR [stderr] (default task-3) at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:181) 18:39:02,833 ERROR [stderr] (default task-3) at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96) 18:39:02,833 ERROR [stderr] (default task-3) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101) 18:39:02,834 ERROR [stderr] (default task-3) at org.jboss.weld.bean.ContextualInstanceStrategy$CachingContextualInstanceStrategy.get(ContextualInstanceStrategy.java:178) 18:39:02,834 ERROR [stderr] (default task-3) at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50) 18:39:02,834 ERROR [stderr] (default task-3) at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99) 18:39:02,834 ERROR [stderr] (default task-3) at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:99) 18:39:02,834 ERROR [stderr] (default task-3) at org.jboss.weldx.jdo.AutoCloseable$PersistenceManager$567584360$Proxy$_$$_WeldClientProxy.makePersistent(Unknown Source) 18:39:02,834 ERROR [stderr] (default task-3) at com.airhacks.UserResource.getUser(UserResource.java:45) 18:39:02,834 ERROR [stderr] (default task-3) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 18:39:02,834 ERROR [stderr] (default task-3) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 18:39:02,834 ERROR [stderr] (default task-3) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 18:39:02,835 ERROR [stderr] (default task-3) at java.lang.reflect.Method.invoke(Method.java:498) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) 18:39:02,835 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,836 ERROR [stderr] (default task-3) at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) 18:39:02,837 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,837 ERROR [stderr] (default task-3) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) 18:39:02,837 ERROR [stderr] (default task-3) at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52) 18:39:02,837 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,837 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) 18:39:02,838 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,839 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275) 18:39:02,839 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327) 18:39:02,839 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) 18:39:02,839 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,840 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) 18:39:02,840 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,840 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47) 18:39:02,840 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,840 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100) 18:39:02,840 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,840 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22) 18:39:02,840 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,841 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) 18:39:02,841 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,841 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67) 18:39:02,841 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,841 ERROR [stderr] (default task-3) at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) 18:39:02,841 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,841 ERROR [stderr] (default task-3) at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54) 18:39:02,841 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,842 ERROR [stderr] (default task-3) at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64) 18:39:02,842 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,842 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356) 18:39:02,842 ERROR [stderr] (default task-3) at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636) 18:39:02,842 ERROR [stderr] (default task-3) at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61) 18:39:02,842 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,842 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356) 18:39:02,843 ERROR [stderr] (default task-3) at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80) 18:39:02,844 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,844 ERROR [stderr] (default task-3) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) 18:39:02,844 ERROR [stderr] (default task-3) at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198) 18:39:02,844 ERROR [stderr] (default task-3) at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185) 18:39:02,844 ERROR [stderr] (default task-3) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 18:39:02,844 ERROR [stderr] (default task-3) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) 18:39:02,844 ERROR [stderr] (default task-3) at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73) 18:39:02,845 ERROR [stderr] (default task-3) at com.airhacks.UserResource$$$view3.getUser(Unknown Source) 18:39:02,845 ERROR [stderr] (default task-3) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 18:39:02,845 ERROR [stderr] (default task-3) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 18:39:02,845 ERROR [stderr] (default task-3) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 18:39:02,846 ERROR [stderr] (default task-3) at java.lang.reflect.Method.invoke(Method.java:498) 18:39:02,846 ERROR [stderr] (default task-3) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139) 18:39:02,846 ERROR [stderr] (default task-3) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295) 18:39:02,846 ERROR [stderr] (default task-3) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249) 18:39:02,846 ERROR [stderr] (default task-3) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236) 18:39:02,846 ERROR [stderr] (default task-3) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:402) 18:39:02,846 ERROR [stderr] (default task-3) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:209) 18:39:02,846 ERROR [stderr] (default task-3) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221) 18:39:02,847 ERROR [stderr] (default task-3) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) 18:39:02,847 ERROR [stderr] (default task-3) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) 18:39:02,847 ERROR [stderr] (default task-3) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 18:39:02,847 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) 18:39:02,847 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) 18:39:02,847 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) 18:39:02,848 ERROR [stderr] (default task-3) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78) 18:39:02,848 ERROR [stderr] (default task-3) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) 18:39:02,848 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) 18:39:02,848 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) 18:39:02,848 ERROR [stderr] (default task-3) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) 18:39:02,848 ERROR [stderr] (default task-3) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) 18:39:02,849 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) 18:39:02,849 ERROR [stderr] (default task-3) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) 18:39:02,849 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) 18:39:02,849 ERROR [stderr] (default task-3) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) 18:39:02,849 ERROR [stderr] (default task-3) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) 18:39:02,849 ERROR [stderr] (default task-3) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) 18:39:02,849 ERROR [stderr] (default task-3) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) 18:39:02,850 ERROR [stderr] (default task-3) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) 18:39:02,850 ERROR [stderr] (default task-3) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) 18:39:02,850 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) 18:39:02,850 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) 18:39:02,850 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) 18:39:02,850 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) 18:39:02,850 ERROR [stderr] (default task-3) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) 18:39:02,851 ERROR [stderr] (default task-3) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) 18:39:02,851 ERROR [stderr] (default task-3) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) 18:39:02,851 ERROR [stderr] (default task-3) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) 18:39:02,851 ERROR [stderr] (default task-3) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) 18:39:02,851 ERROR [stderr] (default task-3) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) 18:39:02,851 ERROR [stderr] (default task-3) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) 18:39:02,851 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) 18:39:02,852 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) 18:39:02,852 ERROR [stderr] (default task-3) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) 18:39:02,852 ERROR [stderr] (default task-3) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) 18:39:02,852 ERROR [stderr] (default task-3) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805) 18:39:02,852 ERROR [stderr] (default task-3) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 18:39:02,852 ERROR [stderr] (default task-3) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 18:39:02,852 ERROR [stderr] (default task-3) at java.lang.Thread.run(Thread.java:750)
|
jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration
2
Hello, i'm trying to deploy a jdo resource adapter to wildfly 10 with this code: https://github.com/urbandroid/datanucleus-jca-adapter java:/TestDS datasource deployed to server resource adapter must use this datasource. I'm getting error below can you help me? 1:55:12,652 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."datanucleus-jdo-jca-6.0.6.rar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."datanucleus-jdo-jca-6.0.6.rar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "datanucleus-jdo-jca-6.0.6.rar" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration at org.jboss.as.connector.deployers.ra.processors.ParsedRaDeploymentProcessor.process(ParsedRaDeploymentProcessor.java:216) at org.jboss.as.connector.deployers.ra.processors.ParsedRaDeploymentProcessor.deploy(ParsedRaDeploymentProcessor.java:127) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147) ... 5 more Caused by: org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration at org.jboss.jca.common.metadata.spec.ResourceAdapterImpl.validate(ResourceAdapterImpl.java:228) at org.jboss.jca.common.metadata.spec.ConnectorImpl.validate(ConnectorImpl.java:350) at org.jboss.as.connector.deployers.ra.processors.ParsedRaDeploymentProcessor.process(ParsedRaDeploymentProcessor.java:187) ... 7 more
|
NullPointerException XmlMetaDataEntityResolver.java:64 with assembly cli jar-with-dependencies
2
This simple test case works fine with mvn clean compile test https://github.com/mores/test-jakarta/tree/uberJar But if you run mvn clean package java -jar target/datanucleus-test-jakarta-6.0-jar-with-dependencies.jar WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance. Exception in thread "main" java.lang.NullPointerException at org.datanucleus.metadata.xml.XmlMetaDataEntityResolver.<init>(XmlMetaDataEntityResolver.java:64) at org.datanucleus.metadata.xml.XmlMetaDataParser.<init>(XmlMetaDataParser.java:90) at org.datanucleus.metadata.MetaDataUtils.parsePersistenceFiles(MetaDataUtils.java:885) at org.datanucleus.api.jakarta.JakartaEntityManagerFactory.getPersistenceUnitMetaDataForName(JakartaEntityManagerFactory.java:1313) at org.datanucleus.api.jakarta.JakartaEntityManagerFactory.<init>(JakartaEntityManagerFactory.java:405) at org.datanucleus.api.jakarta.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:103) at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:80) at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:55) at org.datanucleus.test.App.run(App.java:28) at org.datanucleus.test.App.main(App.java:17) P.S. I had to change from: <jakarta_persistence.ver>3.0.0</jakarta_persistence.ver> to <jakarta_persistence.ver>3.1.0</jakarta_persistence.ver>
|
Is it possible to influence the names of the indices and foreign keys?
7
Something I've been meaning to learn about for literally years - is it possible to influence the names of these indices that have names with suffixes eg _N49, _N50. in my database we used to run in autoCreate mode, so have lots of these. More recently we switched to using flyway and so run only in validate mode; if I forget to create indices then I get warning messages which show the names I'm talking about, eg: ... D.D.Schema : Required indexes missing from dbo.LeaseContract : [CREATE INDEX LeaseContract_N54 ON dbo.LeaseContract (nextLeaseContractVersionId), CREATE INDEX LeaseContract_N55 ON dbo.LeaseContract (brandId), CREATE INDEX LeaseContract_N52 ON dbo.LeaseContract (mainUnitId), CREATE INDEX LeaseContract_N53 ON dbo.LeaseContract (activityId), CREATE INDEX LeaseContract_N56 ON dbo.LeaseContract (comparableUnitOverrideId), CREATE INDEX LeaseContract_N49 ON dbo.LeaseContract (indexId), CREATE INDEX LeaseContract_N50 ON dbo.LeaseContract (landlordId), CREATE INDEX LeaseContract_N51 ON dbo.LeaseContract (tenantId)] I also see something similar for foreign key constraints: D.D.Schema : Required foreign keys missing from dbo.LeaseContract : [ALTER TABLE dbo.LeaseContract ADD CONSTRAINT LeaseContract_FK9 FOREIGN KEY (nextLeaseContractVersionId) REFERENCES dbo.LeaseContract (id) ] Anyway, is it possible to influence these names with an annotation; my experiments so far have come to naught.
|
JDK 21 support
3
Hi I can read from the documentation that DataNucleus 6.X.X supports JDK 11-19. What are the plans for supporting JDK 21? Regards, Kr?n David Christensen
|
How to get the plugin.xml for(rdbms?/core?/api?) with datanucleus 6.x
2
Hi all, I am trying to follow this step which is required for one of our setup. And previously we have done the same thing for datanucleus 3.x However, looks like the github page only have the latest plugin.xml of version 5.2, which does not support jdk17 according to the doc. datanucleus-rdbms datanucleus-core datanucleus-api-jdo Since we want to run jdk17, could you point me the correct plugin.xml for rdbms/core/api to use? Thanks! Best, Steven
|
Howto help improve DataNucleus code base
4
Hello, We have for the last year been migrating our code from using Kodo to use DataNucleus. Through this process we have had to fix bugs, make performance improvements and add plugins to the DataNucleus core and RDBMS code to meet our needs. We have ended up with fixes to around 20 classes in DataNucleus core and RDBMS code. The question is how we can push this back to the community - since we also have the code changes required to fix these problems. We can of course supply 20 forks of JDO test templates and create 20 issues on github for core and RDBMS to prove the problems - but what about the code fixes we already have made - can we also supply them as seperate forks/pull-request to DataNucleus github repository? Please advise us in how we can help improving the code base with our findings. Best regards, Kr?n David Christensen, Stibo Systems
|
1+N avoidance: Fetch of relationship working, but ignored when accessed
10
Hi, I posted my question on StackOverflow, but realized it might be better to post here as on SO there's only 5-ish DN questions per year :-) https://stackoverflow.com/questions/75422362/datanucleus-relationship-fetch-group-confusion Models, queries and logs are all listed there. I have: - Model with relationships - Added the relationships to the fetch group - Retrieved a list of models via a query - Observed in the logs that DN is "bulk fetching" the relationship for all models in the result set to avoid 1+N query problem. So far so good. But when I then traverse the resultset of the query and access a relationship, DN seems to ignore the prefetched results and performs another query for each model. So I end up with 1+1+N queries. I have looked at the fetch groups and those should be OK as the extra query happens even before accessing any fields. The (debug) logs do not state why the prefetched results are not used. I can repeat all the details here from SO, let me know if that's needed. Valentijn
|
Best practices for connection factory configurations when using connection pooling?
3
I'm aware this is kind of a generic question, but is there any guidance or any best practices around connection factory configuration when using connection pooling? We use DN RDBMS with HikariCP, and I was a little bamboozled by the fact that DN creates two connection pools. So providing these properties to the PMF: datanucleus.connectionPoolingType=HikariCP datanucleus.connectionPool.maxPoolSize=20 results in two Hikari pools of up to 20 connections each to be created, which was not clear to me based on the docs, and seems rather excessive. The docs mention: The secondary connection factory is used for schema generation, and for value generation operations (unless specified to use primary). Based on that description it seems like the secondary factory should be fine with a smaller pool than the primary factory. Is that a valid assumption? I see that it is possible to provide custom DataSources as connection factories. This would allow us to provide tweaked HikariCP configurations. I've been looking for examples of how others do it, and only found Apache Hive which allocates a fixed amount of 2 connections to the secondary pool. Justification is "Since DataNucleus uses locks for schema generation and value generation, 2 connections should be sufficient.", which makes sense to me. But maybe I'm overlooking something? Is there anyone else who is willing to share some insight into how to best size the secondary connection pool? What are the factors that would help me in figuring out an optimal size? Thanks.
|
Select with subselect
2
I'd like to implement a JDOQL query for the following SQL statement: select * from project p, project_strategic_bucket psb where psb.project_id_oid = p.id and psb.strategic_bucket_id_oid in (select sb.id from strategic_bucket sb where sb.id in (1, 2, 3, ...)) order by p.prj_nr; (An alternative SQL statement that also works is: select * from project p inner join project_strategic_bucket psb on psb.project_id_oid = p.id where psb.strategic_bucket_id_oid in (select sb.id from strategic_bucket sb where sb.id in (1, 2, 3, ...)) order by p.prj_nr;) I try with something like this query: Query<ProjectStrategicBucket> subQuery = pm.newQuery(ProjectStrategicBucket.class); subQuery.setFilter("param.contains(this.strategicBucket)"); subQuery.declareParameters("java.util.List param"); subQuery.setParameters(searchBean.getStrategicBuckets()); Query<Project> query = pm.newQuery(Project.class, "this.projectStrategicBuckets.contains(projectStrategicBucket)"); query.declareVariables("com.siemens.energy.rdst.data.db.ProjectStrategicBucket projectStrategicBucket"); query.addSubquery(subQuery, "com.siemens.energy.rdst.data.db.ProjectStrategicBucket projectStrategicBucket", null, "param"); results = (List<Project>)query.execute(); But I get the exception: org.datanucleus.exceptions.NucleusUserException: Query has reference to member "strategicBucket" of class "com.siemens.energy.rdst.data.db.Project" yet this doesnt exist! at org.datanucleus.store.rdbms.query.QueryToSQLMapper.getSQLTableMappingForPrimaryExpression(QueryToSQLMapper.java:3606) at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processPrimaryExpression(QueryToSQLMapper.java:3253) at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processInvokeExpression(QueryToSQLMapper.java:4300) at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processInvokeExpression(QueryToSQLMapper.java:4264) How can I solve this problem or implement the query better? I prefer JDOQL because I'd to add multiple several subqueries, for example for ProjectStrategicLens and so on. The O/R Java classes are: Project 1 : N ProjectStrategicBucket N : 1 StrategicBucket Project.java ... @Persistent(mappedBy="project") @Order(column = "LIST_ORDER_IDX") @ForeignKey(deleteAction = ForeignKeyAction.CASCADE) private List<ProjectStrategicBucket> projectStrategicBuckets = new ArrayList<ProjectStrategicBucket>(); ... ProjectStrategicBucket.java: @PersistenceCapable(table = "PROJECT_STRATEGIC_BUCKET", identityType = IdentityType.APPLICATION) @Sequence(name = "ProjectStrategicBucketSeq", datastoreSequence = "PROJECT_STRATEGIC_BUCKET_SEQ", strategy = SequenceStrategy.CONTIGUOUS, allocationSize = 1) @FetchGroups({ @FetchGroup(name = DataServiceConstants.STRATEGIC_BUCKET, members = { @Persistent(name = "strategicBucket"), @Persistent(name = "value"), @Persistent(name = "modificationTimestamp"), @Persistent(name = "person"), @Persistent(name = "project")}) }) public class ProjectStrategicBucket extends AbstractBeanWithId implements Comparable<ProjectStrategicBucket> { private static final long serialVersionUID = 1L; public final static Comparator<ProjectStrategicBucket> BACKET_VALUE_COMPARATOR = new Comparator<ProjectStrategicBucket>() { @Override public int compare( ProjectStrategicBucket bucket1, ProjectStrategicBucket bucket2 ) { return bucket2.value.compareTo( bucket1.value ); } }; @Persistent(primaryKey = "true", nullValue = NullValue.EXCEPTION, valueStrategy = IdGeneratorStrategy.SEQUENCE, sequence = "ProjectStrategicBucketSeq") private Long _id; @Persistent(column = "STRATEGIC_BUCKET_ID_OID") private StrategicBucket strategicBucket; @Persistent private Integer value; @Persistent private DateTime modificationTimestamp; @Persistent private Person person; @Persistent @Column(name="PROJECT_ID_OID") private Project project; /** * @return the project */ public Project getProject() { return project; } /** * @param project the project to set */ public void setProject(Project project) { this.project = project; } /** * Constructor. */ public ProjectStrategicBucket() { } /** * Constructor. * @param strategicBucket */ public
|
Evict parent class from Query Results Cache at commit
2
Hi! I hope you can help with this issue. I have a simple inheritance of these two classes. I've got them mapped like this with subclass-table inheritence strategy. Also I have query results cache enabled in my datanucleus.properties Then in my code I have 2 services classes, one for BasePlayer class which is BasePlayerService where I'm making a select query to retrieve all the players in the database, the other one is for Player which is PlayerService where I'm making a insert of the Player. The 1st list of users shows all the 6 records saved in my database, but when I insert a new Player, the 2nd list shows the same 6 records, but in fact another Player was saved in the database, so the second list should list a total of 7 Players This is the code from my BasePlayerService And this is the code of my PlayerService class for saving a new Player I know that In the BasePlayerService I'm using the class BasePlayer and in the PlayerService I'm using the Player class and I also know that any query related to Player class is evicted from Query Results Cache once the commit is executed. My question is if there is a way to tell datanucleus to evict the results related to the parent class BasePlayer too, because the first list query is being cached and it's not cleared from Query Results Cache. I hope you can help me. If there is any other information you need to understand the issue better, please write me! Thanks a lot!
|
Cache Results not working with "count" query
4
I've got a project with datanucleus v6.0.0-release and in my properties file I've got configured with the following values: As you can see I have the *datanucleus.query.results.cached* enabled In my project I have the following code: I'm calling the count procedure twice, and in the second call throws an error And the line where the exception is thrown is this As I could review in the sources the error happens in the class ForwardQueryResult.java line 186 In this line the value of the nextElement is the result of the count query that is a Long value In the class ApiAdapter.java in line 294 is verifying if the result is Persistable to return an ObjectId but in this case it returns a null value. Then the collection resultIds in the ForwardQueryResult.java class is added to the cache the first time. Then in the second time it throws an error. Is there any way to avoid this without disabling the property datanucleus.query.results.cached ?
|
Persisting attribute using "new" Java time Instant in MySQL
4
Traditionally we have used the java.util.Date class for storing time instants in UTC time - in all existing tables DN has created a 'TIMESTAMP' type field in MySQL - which works fine. Recently we added our first attribute of type java.time.Instant (getting all jiggy with the "new" Java time library - better late than never!) and the DN docs say that the default mapping is a TIMESTAMP (via the convention that the bold type is the default): https://www.datanucleus.org/products/accessplatform/jdo/mapping.html#_temporal_types_java_util_java_sql_java_time_jodatime *Java Type:* java.time.Instant *Comments:* Persisted as *TIMESTAMP* , String, Long, or DATETIME. However, the Instant attribute has been mapped to a DATETIME instead of TIMESTAMP. We have not added any specific customizations to the XML metadata so would assume that it would have mapped to the default TIMESTAMP. Any idea what me going on? Have I misunderstood the docs? Do we need to explicitly set the MySQL type to TIMESTAMP somehow?
|
JDOQL ordering using primary key field
3
If a class does not have an attribute defined to be the primary key field but, rather, relies on DN creating the primary key column in the RBDMS table implicitly, is there any way to specify the default primary key colunn in the ordering clause: e.g. > > Query q = .... > q.setOrdering(score ascending, PRIMARYKEYCOLUMN ascending) > > > I know the column exists in the RDBMS table and could write the native SQL to set up ordering that included it but at the Java level there is no Java attribute to refer to it in JDOQL that I am aware of. Perhaps DN has some keyword that can be used to represent the underlying, implicitly created primary key field. > > >
|