jdo

Joining multiple result set

人走茶凉 提交于 2019-12-11 12:48:09
问题 I am trying to develop a Java application which merges data from multiple data source basically RDBMS. The scenario is some thing like this. I have creates a connection to two data sources, lets say a MSSQL database and other Oracle. Also on each connection a user can create a DataObject( a Java object) which contains a SQL query and a connection. The query is executed on the connection and result are displayed. Now what I want is that my user can join and filter result obtained from multiple

How queryDSL works with interface?

我只是一个虾纸丫 提交于 2019-12-11 10:23:07
问题 I have a set of classes that implements the same interface. For example: public interface Employee{ private String name; public void work(); public String getName(); } @PersistenceCapable(detachable = "true") public class Accountant implements Employee{ } @PersistenceCapable(detachable = "true") public class Secretary implements Employee{ } And another class that holds the Employee implementations: public class Department{ private ArrayList<Employee> employees; public ArrayList<Employee>

javax.jdo.JDOException: Unexpected error during precommit

删除回忆录丶 提交于 2019-12-11 09:59:48
问题 Today i introduced some new fields into my data model and pushed it online and i started seeing this exception. Does anyone have an idea when this happens? org.datanucleus.ObjectManagerImpl preCommit: java.lang.NullPointerException E 2013-04-18 12:45:09.321 X.servlet.util.GAELogger logError: javax.jdo.JDOException: Unexpected error during precommit at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:566) at org.datanucleus.api.jdo

JDO - HashMap within an embedded Class

旧时模样 提交于 2019-12-11 07:03:15
问题 Are you able to store a HashMap within an embedded class on App Engine? I have the following Class: @Persistent(serialized = "true") @Embedded private Stats stats; @PersistenceCapable @EmbeddedOnly public static class Stats implements Serializable { private static final long serialVersionUID = 1L; @Persistent(serialized = "true", defaultFetchGroup="true") private Map<String, Integer> requests; public Stats() { requests = new HashMap<String, Integer>(); } } However, when I attempt to add an

Can DataNucleus persist an abstract base class parameterized with Generics?

安稳与你 提交于 2019-12-11 06:52:42
问题 Using DataNucleus, I have been happy using an abstract base class to provide a 'long' ID to the sub-classes (please note the primitive type). When adapting an example from JPA I got the idea to parameterize the base class. The purpose was to support different ID types, such as String. @PersistenceCapable @Inheritance(strategy=InheritanceStrategy.SUBCLASS_TABLE) @Version(strategy=VersionStrategy.VERSION_NUMBER, column="jdo_version") public abstract class VersionedIdEntity<P> implements

Google says JDO doesn't do cascading deletes from Datastore. So how do you do it?

两盒软妹~` 提交于 2019-12-11 06:08:53
问题 Google says: Note: The JDO implementation does the work to delete dependent child objects, not the datastore. If you delete a parent entity using the low-level API or the Admin Console, the related child objects will not be deleted. So how DO I delete an Entity which has child entities that are ArrayList ??? Shouldn't this be a basic feature - to delete the dependent child entities from a parent Entity? 回答1: Its not saying that JDO doesn't do cascading dependent children. In fact, it's saying

Exception: Query result sets are not modifiable

允我心安 提交于 2019-12-11 05:48:47
问题 I'm trying to write to a JDO store using this code: PersistenceManager pm = PMF.get().getPersistenceManager(); try { pm.currentTransaction().begin(); // deactivate all for current domain Query q = pm.newQuery(CampaignStore.class, "domain == '" + domain +"'"); Collection result = (Collection) q.execute(); CampaignStore toBeEdited = null; Iterator iter = result.iterator(); while (iter.hasNext()) { toBeEdited = (CampaignStore) iter.next(); toBeEdited.setActive(false); } result.clear(); // set

Datanucleus: moving from @Transactional to non-transactional

落爺英雄遲暮 提交于 2019-12-11 04:07:13
问题 I am using Datanucleus, JDO and Spring's declarative @Transactional management woven with Aspect-J. But when a 'normal' method gets a persistent object from a @Transactional method, the object's state will become transient (the persistence manager seems to be removed) and the object is no longer persistent. Example: public class Example { public void test() throws Exception { Login l = getLogin(); JDOHelper.getObjectState(l); // transient instead of persistent l.getSomeOtherPersistentObj()

JDO in AppEngine: keep the original entity when deleting from unowned relationship

泪湿孤枕 提交于 2019-12-11 03:23:01
问题 I have defined an unowned relationship using JDO 3.0 syntax: @Persistent @Unowned private Set<Role> roles; I have several predefined roles which should be assigned to users. I use following code for adding/removing roles to users: roles.add(roleEntity); roles.remove(roleEntity); The problem is that removing like this also removes the original entity from the datastore but I just want to remove the reference. I know I could store only Keys inside the parent entity which would solve the problem

What is the correct way to atomically increment a counter in App Engine?

主宰稳场 提交于 2019-12-10 15:56:01
问题 I am using Java on Google App Engine and I am most familiar with the JDO datastore interface. I am trying to implement a simple download counter which stores its data in the App Engine datastore. I am only expecting a few thousands downloads/month so the update rate for my counter will be pretty low. I am therefore not interested yet in sharding the counter. Pragmatically I could probably ignore locking and accept that I would occasionally lose an update. However, I would like to know what