persistence

How can I persist an array of a nullable value in Protobuf-Net?

走远了吗. 提交于 2019-12-06 02:42:00
I am in the process of migrating from BinaryFormatter to Protobuf-net (which so far appears to offer HUGE improvements both in terms of storage size and deserialization time). A problem I've encountered however is that double?[] arrays do not deserialize in the same form they were serialized. Any values in the array that are null get removed in their entirety - i.e. if I start with an array with 6 elements of [null, null, 1, 2, 3, null], after deserialization I end up with an array of [1, 2, 3]. For my programme, it is essential that I retreive these arrays in exactly the same form they were

Firebase 3.0 session persistance

99封情书 提交于 2019-12-06 00:13:14
问题 It seems impossible to use session persistence in firebase 3.0. This was possible in the previous version: https://www.firebase.com/docs/web/guide/login/password.html authWithPassword() takes an optional third parameter which is an object containing any of the following settings: remember - String If not specified - or set to default - sessions are persisted for as long as you have configured in the Login & Auth tab of your App Dashboard. To limit persistence to the lifetime of the current

JBoss7 + PostgreSQL New missing/unsatisfied dependencies

放肆的年华 提交于 2019-12-05 23:06:41
im migrating a Project from JBoss3 to JBoss7. I just started yesterday and reconfigured my standalone.xml, module.xml and persistence.xml. In the JBoss modules folder, i created the org/postgres/main dir. In this dir i got the new Postgres JDBC41 Driver and my module.xml. This is what i get, if i want to start the JBoss: 14:42:53,697 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report JBAS014775: New missing/unsatisfied dependencies: service jboss.jdbc-driver.postgresql (missing) dependents: [service jboss.data-source.java:jboss/datasources/RESyDS] 14:42

Entity Framework Not Saving / Stop database being rebuilt

大兔子大兔子 提交于 2019-12-05 22:17:56
I am teaching myself about the entity framework using a tutorial found at http://msdn.microsoft.com/en-us/data/jj591506 . I am working with the code below. using (var db = new DatabaseEntities()) { var section = new Section { SectionID = 1, SectionName = "Bob" }; db.Sections.Add(section); db.SaveChanges(); } For some reason this code is not writing to my database. No error are being thrown. Do you have ideas what I could look at or what could be the cause? This is an almost exact copy of the example give on the MSDN page linked above. This problem looks very similar to what is happening in

java.lang.IllegalArgumentException: Named query not found.(Entity Manager not creating NamedQuery)

左心房为你撑大大i 提交于 2019-12-05 22:09:48
I am using hibernate 4.1.5.Final and Spring 3.1.2 Release and Jboss 7.1 . I have written all named queries in a class with @NamedQuery annotation but entity manager not creating named query . i am posting the stacktrace and context.xml 09:58:49,695 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) java.lang.IllegalArgumentException: Named query not found: validateLoginHash 09:58:49,770 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:642) 09:58:49,772 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)

How to persist a Map<String, List<Object>> in Hibernate

…衆ロ難τιáo~ 提交于 2019-12-05 20:04:30
I've got a Map containing MyObject instances. The MyObject class uses JPA to persist its fields: @OneToMany(cascade = CascadeType.ALL) @LazyCollection(LazyCollectionOption.FALSE) private Map<String, MyObject> results = new HashMap<String, MyObject>(); We changed the value stored by the Map to a List : private Map<String, List<MyObject>> results = new HashMap<String, List<MyObject>>(); But upon launching we receive a stack trace: Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.me.myapp.MyObject.results[java.util.List] at org

Why is it necessary to annotate mapped Date fields @Temporal in javax.persistence?

爱⌒轻易说出口 提交于 2019-12-05 18:02:17
The format goes like this: @Temporal(TemporalType.DATE) @Column(name="CREATED_DATE") private Date createdDate; My question is: Why is it necessary to annotate mapped java.util.Date fields as @Temporal in javax.persistence ? If the local variable is obviously declared as a Date and the column data type in the DB is also one of the date(time) or timestamp types, shouldn't it be easy to infer that we're dealing with a temporal bit of data without redundantly specifying it in multiple places? From e.g. java.util.Date it's not obvious if one wants to map to DATE or TIMESTAMP database type. Only

Firing JPA listeners on collection field change

[亡魂溺海] 提交于 2019-12-05 17:00:18
I am using EntityListeners ( @PreUpdate ) to perform certain actions once my entities change. However I noticed that changes of a collection inside an entity does not fire the JPA entity listener, that makes sense because the table containing the entity was not changed, but a many to many table was. Is there a way to make the entity listener fire in case of a collection change? Kariem Listeners are fired for versioned entities (see javax.persistence.Version ). Found via this answer: https://stackoverflow.com/a/17073342/12039 I would expect the events to be called. What JPA provider are you

How to properly implement a custom session persister in PHP + MySQL?

…衆ロ難τιáo~ 提交于 2019-12-05 16:50:34
问题 I'm trying to implement a custom session persister in PHP + MySQL. Most of the stuff is trivial - create your DB table, make your read/write functions, call session_set_save_hander() , etc. There are even several tutorials out there that offer sample implementations for you. But somehow all these tutorials have conveniently overlooked one tiny detail about session persisters - locking . And now that's where the real fun starts! I looked at the implementation of session_mysql PECL extension of

JPA: How to get Id after persist in standalone java app

旧巷老猫 提交于 2019-12-05 16:10:13
This is a standalone java application, not web application. So when I persist the object like this public <T> T create(T t) { em.getTransaction().begin(); em.persist(t); em.flush(); em.getTransaction().commit(); return t; } The id inside the T t object is still null, even though a new row with correct data and id is created correctly inside the database. Usually in my web app that utilize @EJB , the id available right after I persist, since it persist the entity object into my persistence context, I am not sure if I have my persistence context here? This is how I mapped my id inside my @Entity