error in Xquery update ( eXistdb) - xquery-update

when i am trying toupdate data into database i found following error'XQuery update expressions can not be applied to in-memory nodes.'...how to resolve this anyone help me....

I believe the documentation on eXist clearly specifies that update doesn't work on in-memory nodes. It only works on XMLs that are persisted in the database. Here is the link:
http://exist.sourceforge.net/update_ext.html

Related

I am facing this issue , when i run a web api in swagger....how I solve this error?

Null Exception Error
Designation Repository class
Judging based on limited information provided.
Simply put it means that you are trying to use something that doesn't exist.
Essentially this is returning a null value.
Without better question can't provide further help

Azure DocumentDB Null Handling

I have started working with Microsoft's NoSQL services on Azure. One thing that came up was the aspect of how to exclude null based values from updating/saving operations. I haven't found anything explicit to how a null based value can be excluded from the JSON serialization if it is null. So if anyone knows how to do this I'd like to know.
Peter
OK; digging the the API I found that the DocumentClient operations are using NetwonSoft. NewonSoft has attributes that can identify if a null value is to be included within the serialization, JsonProperty/NullValueHandling. The intersting thing I found was that in update operations - if a value is not in the JSON results -- the resultant document will have the value removed (if it is there). Not what I was expecting.

symfony2 / doctrine2 flush createas a select after delete

I'm removing an entity with these commands:
$this->getEntityManager()->remove($exclusivedeal->getPicture());
$exclusivedeal->setPicture();
$this->getEntityManager()->flush();
$this->getEntityManager()->getConnection()->commit();
The picture Attribute is a ManyToOne relation to the picture entity.
The picture Entity has a function that is called via the postremove Annotation to remove the picture physically from the filesystem. The Flush() operation is doing the sql statements. After the delete Statement, an select statement is called too. This creates the following error:
[2012-06-07 10:06:46] request.CRITICAL: Doctrine\ORM\EntityNotFoundException: Entity was not found. (uncaught exception) at C:\xampp\htdocs\forum\app\cache\dev\doctrine\orm\Proxies\__CG__DankeForumBundleEntityPicture.php line 32 [] []
When i change the annotation to preRemove, everything is fine, but this can't be the solution. I'm doing the same operation on an other Entity with a relation to the Picture Entity.
When i set the cascade remove annotation, the same problem is happened.
Has anyone an idea what i'm doing wrong?
Thank you very much.
I had the same issue and it gave me a lot of headaches trying to solve the problem. I finally found the issue.
The cookbook on the symfony website for handling file uploads with doctrine has been updated to solve this issue.
I just hit this exact same problem and found the issue in my case was because I was using both cascade={"all"} (i.e 'remove') and onDelete="CASCADE".
Changing the cascade to "persist" solved it and Im now able to delete entities with image associations.

Problem persisting collection of interfaces in JDO/Datanucleus. "unable to assign an object of type.."

I am getting below error whilst trying to persist an object that has a collection of interfaces which I want to hold a couple of different types of objects. Seems to be happening almost randomly. Sometimes after restarting it works ok ( I might be doing something wrong though).
class CommentList {
#Persistent
#Join
ArrayList<IComment> = new ArrayList<IComment>();
}
somewhere else...
CommentList cl = new CommentList();
cl.addComment( new SimpleComment() );
cl.addComment( new SpecialComment() );
repo.persist( cl );
I can see the join table has been created in my DB along with ID fields for each of the Implementation classes of IComment.
SimpleComment and SpecialComment implement IComment. If I just add a SimpleComment it works fine. As soon as I start trying to add other types of objects I start to get the errors.
error im getting
java.lang.ClassCastException: Field "com.myapp.model.CommentList.comments" is a reference field (interface/Object) of type com.myapp.behaviours.IComment but DataNucleus is unable to assign an object of type "com.myapp.model.ShortComment" to this field. You can only assign this field to a type specified by the "implementation-classes" extension attribute.
at org.datanucleus.store.mapped.mapping.MultiMapping.setObject(MultiMapping.java:220)
at org.datanucleus.store.mapped.mapping.ReferenceMapping.setObject(ReferenceMapping.java:526)
at org.datanucleus.store.mapped.mapping.MultiMapping.setObject(MultiMapping.java:200)
at org.datanucleus.store.rdbms.scostore.BackingStoreHelper.populateElementInStatement(BackingStoreHelpe
r.java:135)
at org.datanucleus.store.rdbms.scostore.RDBMSJoinListStoreSpecialization.internalAdd(RDBMSJoinListStore
Specialization.java:443)
at org.datanucleus.store.mapped.scostore.JoinListStore.internalAdd(JoinListStore.java:233)
When it does save, if I restart the server and try to query for a list of the comments, I get null values returned.
I'm using mysql backend - if I switch to db4o it works fine.
Please let me know if any info would be useful.
If you have any idea where I might be going wrong or can provide some sample code for persisting collection of different objects implementing the same interface that would be appreciated.
Thanks for any help.
Tom
When I used interfaces I just enabled dynamicSchemaUpdates (some persistence property with a name like that) and FK's are added when needed. The log gives all SQL I think
I fixed this by specifying
<extension implemention-classes="SimpleComment SpecialComment"/>
for the field cl in my pacakge.jdo.

LINQ to SQL repository - caching data

I have built my first MVC solution and used the repository pattern for retrieving/inserting/updating my database.
I am now in the process of refactoring and I've noticed that a lot of (in fact all) the methods within my repository are hitting the database everytime. This seems overkill and what I'd ideally like is to do is 'cache' the main data object e.g. 'GetAllAdverts' from the database and to then query against this cached object for things like 'FindAdvert(id), AddAdvert(), DeleteAdvert() etc..'
I'd also need to consider updating/deleting/adding records to this cache object and the database.
What is the best apporoach for something like this?
My knowledge of this type of things is minimal and really looking for advice/guidance/tutorial to point me in the right direction.
Thanks in advance.
This just hit my radar, and I assume you have already solved the issue by now. But if not, I would look into Pre-Compiled LINQ Queries. Something like this:
private static Func<SomeDataContext, int, PersonDto> _getPersonByIdQuery =
CompiledQuery.Compile<SomeDataContext, int, PersonDto>(
(dataContext, personId) =>
dataContext.PersonDtos.where(c => c.PersonId == personId).FirstOrDefault()
);
Put something like that inside of your datacontext, then add an internal method in there to call it call it. Your retriever/saver will then call the internal method. Does that make sense? I can post more code if necessary..
Best of luck,
Justin

Resources