The official documentation https://developers.google.com/appengine/docs/java/datastore/entities is not clear on the parent relationship of the Datastore: "The Datastore API does not distinguish between creating a new entity and updating an existing one" SO, does saving entity with the same key not only updates properties but also deletes descendant entities?
According to the test on my local machine (simulated datastore), updating properties does not delete descendant entities. Therefore updates are possible, although are not reflected in the syntax of API.
Related
Given your example:
https://github.com/corda/flow-db
I have a question.
Is it ok to create and store custom data within the Node database? Reading the Corda API Persistence section, I thought it could be used only to access the node database, and not to create new tables, etc. What would be a reasonable description of what can and what cannot be stored via CordaService?
It's totally OK to use Custom tables in Node. The ServiceHub actually provides you will a Connection Object. getServiceHub().jdbcSession(). As long as, you don't do some Update/Delete to the Nodes existing table you are fine. You can create any table you want and use it as per your need. As of now, corda doesn't expose JPA to map your tables to an Entity class. I guess you could see this feature in some future release.
I have created a new Entity in Dynamics 365 for Operations and I am trying to populate it using the Azure Logic App 365 for operations connector.
The logic app connector connects to the D365o instance and lists a large number of entities, but not the custom one I created. I have verified I am connected to the right instance by inserting data into one of the listed Entities and verifying the data.
I have looked at the properties on the Entity I created and nothing really stands out, public was set to yes by default and I have not touched anything else. Any ideas on what I could be missing in order to expose my custom Entity to the logic app connector?
Thank you
"I have looked at the properties on the Entity I created and nothing really stands out, public was set to yes by default and I have not touched anything else."
Does it mean that you left PublicCollectionName and PublicEntityName empty? Can you fill them in, recompile, refresh data entity list and try accessing your data entity again, using its PublicCollectionName?
We are having a requirement in which we want to update the state of a JPA object in coherence cache with out having to update it in database.
We are currently using query.setHint( QueryHints.QUERY_REDIRECTOR, new IgnoreDefaultRedirector() ); to impliment caching .
Any Example to achieve this is Appreciated.
It sounds like you are using TopLink Grid (http://www.oracle.com/technetwork/middleware/ias/tl-grid-097210.html).
In that scenario TopLink Grid controls the usage of Coherence caches, including how many separate caches are used (it uses a separate cache per entity type; the cache names by default are the unqualified names of the entity classes). The keys of the Coherence caches are the IDs of the entities, and the values are the actual entity objects (possibly wrapped, see below), not "CacheEntry" objects from which entities are constructed, as is the case with Hibernate second-level caching.
The only way I know to update the state of a JPA entity cached in Coherence by TopLink Grid is to violate the encapsulation of TopLink Grid - i.e. bypass the JPA API, and use the Coherence API directly, with knowledge of how TopLink Grid uses Coherence caches. For example you could use a ConditionalPut processor (with the condition being AlwaysFilter.INSTANCE), or perhaps a PofUpdater processor, to update your entity.
But be aware that there are some complexities to do with relationships between entities. If an entity has relationship mappings, the value in the Coherence cache for that entity is an instance of a generated class wrapping the actual entity and holding relationship information. So you'll have to account for that when using the Coherence API directly on a TopLink Grid cache (see http://docs.oracle.com/middleware/1212/coherence/COHIG/tlg_integrate.htm#BGBCDFFJ).
In reading an article on N-Tiered Applications, I came across information regarding concurrency tokens and change tracking information:
Another important concept to understand is that while the
default-generated entities support serialization, their
change-tracking information is stored in the ObjectStateManager (a
part of the ObjectContext), which does not support serialization.
My question is three-fold:
Is there the same thing when using DbContext?
If the only interaction with the database is in a Repository class within a using statement, does closing the database connection when the program leaves the using statement get rid of any option for change tracking?
Can this be leveraged as/with a Concurrency Token?
Yes. DbContext is just wrapper around ObjectContext and it exposes change tracking information through ChangeTracker property (returns DbChangeTracker) and for particular entity through calling Entry method (returns DbEntityEntry<T>).
Yes. Closing context will remove all change tracking information.
Concurrency token and change tracking are two completely different concepts. Change tracking tells context what operations it has to execute on database when you call SaveChanges. It tracks changes you did on your entities since you loaded them into current context instance. Concurrency token resolves optimistic concurrency in the database => it validates that another process / thread / user / context instance didn't change the same record your context is going to modify during SaveChanges.
I've added insert/update methods to the domain service class.
They start with the appropriate words Insert/Update and are marked with the correspondent attributes.
Yet, they fail to get generated at the client-side so they are unavailable
from the domain context.
Is it a bug, a known by-design feature, or am I missing something?
Thanks in advance
These methods are not exposed on the client side. They are used when SubmitChanges() is called to insert, update and delete entities in the entity collection. You can add and update entities in the entity collection and they will be marked as changed or added. Then when SubmitChanges() is called, your server side code will be used.
I found this article helpful:
How SubmitChanges works in .NET RIA Servies