FAQ Database Discussion Community


what are the use cases for persistant, in-order message broker

persistence,message-queue,raft
Using RAFT distributed consensus algorithm one call build a distributed message broker. The broker will also have the additional feature of supporting in-order delivery of messages to subscribers. The messages belonging to a topic will be delivered (or pulled from subscribers, in case of a pull model) in the order...

What is correct way to do CRUD operation in JPQL when working with multiple IDs

java,jpa,orm,persistence,crud
I was wondering what is the pereferred/correct way to do operations that involve fetching and removing multiple entity objects? Here's an example: Here's the way that uses IN operator: @Override public void delete(Iterable<Long> ids) { startTransaction(); Query query = getEntityManager().createNamedQuery(Entity.DELETE_ALL_BY_IDS_NQ); query.setParameter(Entity.DELETE_ALL_BY_IDS_PARAMS[0], ids); query.executeUpdate(); endTransaction(); closeTransaction(); } where the named query...

Is lightweight migration needed when changing validation rules in Core Data

ios,validation,core-data,migration,persistence
I know that lightweight migration can handle those things : Adding or removing an entity, attribute, or relationship Making an attribute non-optional with a default value Making a non-optional attribute optional But do we need lightweight migration for changing validation rules? And how to handle situation where we have defined...

Delete all data from specific Realm Object Swift

swift,persistence,realm
Before i get too far into my question. My goal, which may influence your answers, is to remove Object data if it is no longer in the cloud. So if I have an array ["one", "two", "three"] Then in my server I remove "two" I want my realm to update...

hibernate does not insert to join table automatically

java,hibernate,many-to-many,persistence
I'm working on a java spring mvc application with hibernate. I have two Entities Acl and AclGroupand These two entities have Many to Many relationship with a join table. But, when I save an AclGroup object, hibernate doesn't insert any record in join table and just inserts into AclGroup table....

A way for saving data after closing a C program [closed]

c,persistence,persistent-storage
I want to use the c-programming language to built a small database for students. Only the admnistrator should enter delete or modify the data. I have developed this program in C. But when i close my program, the data is lost. At the beginning i thought to store these data...

Simple javascript counter no frills, just count

javascript,persistence,counter
I have the number 3,453,500 it needs to increase by +1 every 4 seconds. Need to keep the formatting the same (commas in the right place) (also is there a way that this can count continuously without the refreshing to the lowest number on page refresh?)...

using c3p0 with java MVC (JDK 1.6)

spring-mvc,persistence,c3p0
I'm trying to create global connections for multiple WAR files (apps) to use. Each project use entity manager architecture and maven. I'm using spring 3.5.1, tomcat 6.0.39, JDK 1.6.0_45, C3P0 0.9.1.2, hibernate-c3p0 4.2.3.Final, com.mchange c3p0 0.9.2 I saw examples all over but none works for me, I'm not sure why....

How can we persist states and transitions in stateless4j based State Machine?

persistence,workflow,finite-state-machine,state-machine-workflow
I am working on implementing a state machine for a workflow management system based on the Stateless4j API. However, I am not able to find an effective way to persist the states and transitions in Stateless4j. As part of our usecases, we have the requirement to keep States alive for...

Spring hibernate persistance exception detached entity

java,spring,hibernate,jpa,persistence
i have a problem that when i execute a entitymanager.persiste(object) it throws an exception Here are my files : Entities : @Entity @Table(name = "user") public class User extends BaseEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "iduser") @GeneratedValue(strategy=GenerationType.AUTO) private Integer userId; @OneToMany(mappedBy="user",fetch =...

EntityManager becomes null

java,hibernate,jpa,persistence
I have a curious error when using EntityManager. Here is an extract of the code. @PersistenceUnit EntityManagerFactory factory; @Resource UserTransaction transaction; EntityManager em; Inside the method: try{ datos.crearDatos(docEntrada); ctx.setDatosMensajes(datos); factory=Persistence.createEntityManagerFactory("ealia"); transaction = (UserTransaction)new InitialContext().lookup("java:comp/UserTransaction"); EntityManager em = factory.createEntityManager(); //Do whatever it does, everything works fine. // HERE THE ENTITY MANAGER...

JPA not receiving updated data

java,jpa,persistence
I use a managedBean that goes into the db and defines the bean properties with db data. However when I update the db the data I receive in my bean is not updated. The query in db is like this: private static final String JPQL_FIND_BY_ID = "SELECT c FROM Category...

Core data integer32 vs integer64

ios,core-data,integer,persistence
I can't actually decide what should be used between these two types in next situation: I know that certain attribute in my app will have range between 0 - 1000000 and targeted devices can support both 32 and 64 bit architecture. For storing such a value I need uint32_t which...

Do NSUserDefaults persist when installing a new build through Testflight?

ios,persistence,nsuserdefaults,testflight
User defaults persist between regular updates, but what about between Testflight builds? I'm guessing they do, but it is a test environment after all. Related to this question, but not the same. I would have tested this myself but my phone is being held for ransom at a repair shop,...

Java - Can Hibernate choose between two dataase configurations in persistence.xml?

java,hibernate,tomcat,persistence
I have a Java app running on Tomcat 7.0 with Hibernate managing the database. I need to be able to switch the jdbc.url depending on a system environment variable (or possible another flag of sorts). Ultimately, I would like to be able to deploy a staging and production version of...

Servlet does not persist an Entity

java-ee,servlets,jpa,persistence,entitymanager
What do I want to do: I just started with JPA and therefore i want to understand how persisting Entitys from different perspectives work (Application-Managed, Container-Managed). Application-Managed works fine, however i have problems persisting an Entity with an Entity Manager from within a Web Application using a TestServlet. What have...

Huge memory leak during Hibernate entity persisting, why?

java,hibernate,jpa,memory-leaks,persistence
I am using Hibernate with JPA EntityManager, not Hibernate sessions. Most people seem to recommend using a new EntityManager for every transaction, so that is what I'm doing. So, I create 10000 new entities in a row. The heap usage is about 90 MB on the first iteration and 5...

Store JPA entity with given field object id instead of object itself

java,jpa,persistence
The problem is following: We have entity: @Entity public class Feedback { @Id @GeneratedValue(generator="token") private String id; @ManyToOne private Product product; private String message; // other fields } And we have a server endpoint, that receives feedback from clients. Feedback received in multipart/form-based format, with fields: ProductId - product identifier...

Auto-COmmit of DDL

mysql,transactions,persistence,rdbms,ddl
I read that "CREATE TABLE" and "DROP TABLE" statements are auto-commit. I am trying to understand their behaviour for the below scenario: conn.setAutoCommit(false); stmt = conn.createStatement("CREATE TABLE ..."); conn.commit(); In the above case, would setting autoCommit to false would have any impact on CREATE TABLE auto-commiting. If conn.setAutoCommit(false) does override...

What are Relational Objects?

database,jpa,persistence
I am referring to this http://www.tutorialspoint.com/jpa/jpa_architecture.htm for learning JPA ,Here a table is given In query row what is relational object they are referring to? Are they the objects of entity classes which I am making or something else....

rabbitMQ persistency when consummers die

queue,rabbitmq,persistence
I would like consummers to subscribe to events, in case one of them die, I'd like the messages to be persisted for this consummer, so it gets them once it is online. If the producer creates N queues, 1 per consummer, then it works. But the producer shall not not...

Which is best data access options available for Play framework with Scala and PostgreSQL?

hibernate,postgresql,scala,playframework,persistence
We have earlier experiences and lots of reusable code/components mostly done using Spring MVC, Hibernate, PostgreSQL database. But recently we are planning to start a new project. We decided to use Play framework with Scala. We are new in Play framework with Scala. Thus we couldn't decided what ORM (Object-relational...

Slick 3 - ForeignKeys are not generated

mysql,scala,persistence,slick,play-slick
I cannot seem to find a solution to this weird bug: class Names(tag: Tag) extends Table[Name](tag, "NAME") with Identifiable[Name]{ def firstName = column[String]("firstName") def lastName = column[String]("lastName") def profileId = column[Int]("profileId") def * = (id.?, firstName, lastName, profileId) <> ((Name.apply _).tupled, Name.unapply) def profileFk = foreignKey("profile_fk", profileId, TableQuery[Profiles])(_.id, onDelete=ForeignKeyAction.Cascade) }...

Table expression and table variable/temporary table persistence

sql-server,persistence,common-table-expression,temp-tables,table-variable
From what I understand, table expressions do not persist, meaning every reference to it in the outer code is a repeated call to the definition. This is where table variable/temp tables comme into the picture, to persist the table and avoid re-evaluating every single time. It seems to me table...

Advice around persisting app data

android,sqlite,set,maps,persistence
I'm looking for some advice on the best approach in storing some data within my app. The app data is structured around a series of Set and Map collections (these collections hold primitive as well as simple object data types). I want to store the state of these various collections...

FileURL gets invalid each time I rebuild the application or install a new version

ios,persistence
I'm saving videos and audio files I'm recording in the application I'm working on. Here's an example of a URL part: @"file:///var/mobile/Containers/Data/Application/1AADB360-ABA7-493E-AE35-290803AA2EBD/Documents/444571753026.caf" If I rebuild or install a new version from testflight, the application doesn't find the file, and if I save another one, the bold part of the URL...

AKKA.NET Journals and Snapshot Store

persistence,akka,akka.net
Since I have not seen any example of using AKKA.NET Journals and Snapshot store, I assume I have to use both type of actors to implement an Event Store and CQRS. Is the Snapshot store expected to be updated every time when the actor state is changed, or should be...

Does Consul persist the Key Value store?

persistence,key-value,consul
I'm evaluating a few distributed key-value stores, and etcd and Consul looks both very promising. I am interested in service discovery, health monitoring and config services. I like the extra features that Consul gives, but I cannot determine whether it persists the Key-Value store when the service goes down? It...

JPA AccessType.Property failing to retrieve value from nested classes

java,jpa,persistence
I'm attempting to parse JSON into an @Entity in order to persist the data in a table. I confirmed the parsing works but I have run into an issue when attempting to persist the data. In order to retrieve the needed value in the nested classes (two deep) I am...

use runDB in a SubSite Yesod

haskell,persistence,yesod
i want create a post method in a SubSite to create a new entity, i have this AForm demoForm :: RenderMessage master FormMessage => Maybe Demo -> AForm (HandlerT master IO) Demo demoForm demo = Demo <$> areq textField (fieldSettingsLabel ("fieldone"::T.Text)) (demoFieldOne <$> demo) <*> areq intField (fieldSettingsLabel ("fieldone"::T.Text)) (demoFieldTwo...

Can't create a docker mysql with data-only container

mysql,persistence,docker
I'm trying to create a mysql container, that can "volume-form" a data-only container.I use dockerfile/mysql, and the data-only volume is from the Dockerfile : FROM busybox VOLUME /var/lib/mysql CMD ["true"] I can start a simple mysql daemon with docker run -d dockerfile/mysql, but when connected with a data-only volume,( whether...

Update list with new element from persist object

java,hibernate,persistence
I have fetched one object from database by using Hibernate and trying to add child object in list, But it shows that "parent key not found" error. Here is my Hibernate mapping <hibernate-mapping> <class name="com.demo.hibernate.Employee" table="EMPLOYEE"> <id name="id" type="int" column="id"> <generator class="increment" /> </id> <property name="name" column="name" type="string"></property> <property name="edu"...

Eclipse error using Maven filtering in persistence.xml

maven,jar,persistence,filtering
I have a Maven project with JPA using hibernate. I had to specify a jar file to load external classes in persistence.xml located in src/main/resources/META-INF <persistence unit name="PersistenceUnit" transaction-type="JTA" ... <jar-file>lib/${project.persistencejar}.jar</jar-file> using Maven filtering (the filename can change based on various Maven settings). I instruct then Maven to filter by...

Object persistence doesn't work

java,glassfish,entity,persistence
I'm trying to implement a little chat with JPA. Everythings work except one thing. I want, when my user open the connection with the endPoint, save his room number, his nickname and the timstamp. My table has been well created, columns too but i cant persist my Connexion Object in...

WildFly could not fork new process for connection

java,postgresql,persistence,jboss7.x,openshift
I'm running simple OpenShift instance with WildFly app and PostgreSQL and constantly getting Caused by: org.postgresql.util.PSQLException: Connection rejected: could not fork new process for connection: Resource temporarily unavailable which I'm observing in my server.log How can I fix this? app trying to connect Postgre and get out of threads my...

rails mongoid: how to turn of persistence of nested_attributes on assign_attributes

ruby-on-rails,mongoid,persistence
Here is some simplified code: class Page include Mongoid::Document has_many :content, class_name: 'Content', dependent: destroy, autosave: false accepts_nested_attributes_for :content field :title, type: String end class Content include Mongoid::Document belongs_to :page field :text, type: String end class PagesController < ApplicationController def update @page = Page.unscoped.find(params['id']) @page.assign_attributes params.require(:page) puts @page.reflect_on_association(:content) # {:relation=>Mongoid::Relations::Referenced::Many,...

DDD logic and Persistence Ignorance

c#,.net,orm,domain-driven-design,persistence
Consider the following scenario: public class Document { private ISet<User> sharedWith; public Document(string name) { this.sharedWith = new HashSet<User>(); this.Name = name; } public string Name { get; private set; } public IEnumerable<User> SharedWith { get { return this.sharedWith; } } public void ShareWith(User user) { if (this.SharedWith.Contains(user)) { throw...

JPA base64 generator

java,hibernate,jpa,persistence,jpa-2.0
How can I define base64 generator for the value based on id? for example, I have an entity: @Entity class Test{ @Id @GeneratedValue(strategy = GenerationType.AUTO) int id; //here should be the assigned value encoded to base64 based on id String value; } ...

Measuring performance of MongoDB + Hibernate OGM in application

hibernate,mongodb,nosql,persistence,hibernate-ogm
I have an application (MongoDB + Hibernate OGM) that contains some features. I would like to measure the performance of the persistence technology for certain operations (search, adding, deleting etc.) for those particular features. Because I am measuring the performance of those features, I would think the best way would...

Persist Process Variable in jBPM 6.2.0

persistence,jbpm
We have a Domain object which is set as a process variable. This Domain object has ORM (Object Relationship Mapping) set in jBPM Database and is mapped to DOMAIN table. We set certain status in the domain object on entry script and on exit script of every human task. We...

(Python-3) How do you maintain the value of a variable that was changed by the program it was ran by?

python,python-3.x,tkinter,persistence,tkinter-canvas
I am currently trying to build my first GUI application through python's standard Tkinter. I soon came to grips with the computers coordinate system, and indeed I found I could pan things out as I so wish, but I came to the realisation that a drag and drop feature would...

PersistentActor doesn't receive command

scala,persistence,akka
I have implemented the following PersistedActor import akka.actor._ import akka.persistence._ object TaskDispatcher { /** * Create Props for the actor */ def props(): Props = Props(new TaskDispatcher()) case class AddEndpoint(serverEndpoint: ActorRef, id: String) } class TaskDispatcher() extends PersistentActor with ActorLogging { import TaskDispatcher._ override def persistenceId = "task-dispatcher-persistence-ID" // Actor...

Check if JPA entity exists without loading it

java,jpa,persistence,eclipselink
The problem is following. We have a server endpoint, that receives feedback from clients. Feedback received in multipart/form-based format, with fields: ProductId - product identifier Message - feedback message Log_file - attached log file Screenshot - attached screenshot file Server code first checks if the product with given id exists...

Hazelcast eviction and distributed queries

java,persistence,hazelcast
Here you can read how a query (not a get operation) works in Hazelcast: The requested predicate is sent to each member in the cluster. Each member looks at its own local entries and filters them according to the predicate. At this stage, key/value pairs of the entries are deserialized...