persistence

PHP: Building an Adjacency List through Recursive Iteration

爱⌒轻易说出口 提交于 2019-12-25 02:59:41
问题 I'm trying to build a flattened array that preserves metadata from a pretty tricky array coming from a view in my CodeIgniter project. That metadata is things like an identifier, depth, and parent node. The data is from a query builder JavaScript library that allows a user to generate rules that will be used in business logic. I need to persist this data, and the model I've gone with to represent the tree-like nature of these rules is an adjacency list. Here's what I have, and it does work

Hibernate - Add member entity instance by ID

◇◆丶佛笑我妖孽 提交于 2019-12-25 02:43:38
问题 I have an entity of type A with a referenced member entity of type B. I want to insert a relationship between an instance of A to an existing instance of B without having to fetch B. Is there a way to do it simply by ID? Something like: B mockB = new B(); mockB.id = "id_persisted_b"; instanceA.setB(mockB); Thanks. 回答1: If you are using JPA you can use EntityManager.getReference() to obatin a proxy of the object without fetching all the fields, e.g.: B mockB = entityManager.getReference(B

Persisting entity to database with JPA and autogenerated primary key identity

送分小仙女□ 提交于 2019-12-25 02:42:18
问题 I have a full Java EE web application with a presentation layer and a database. I'm using derby with glassfish 3.1 and JPA to handle persistence. I've created a Read ok but now I'm having troulbe doing a Create and persisting to the database. I think I'm close but something is not right with the way I'm trying to do the create. Here is my EAO code: /** * Session Bean implementation class XRSSeao */ @Stateless @LocalBean public class XRSSeao { @PersistenceContext EntityManager em; public

About Mapping Object To Database Using Hibernate

冷暖自知 提交于 2019-12-25 01:49:44
问题 Hello guys i am new to hibernate. while i was surfing stack overflow for hibernate related topics i found this Need clarification about mapping objects to database, annotations, and one to many relationships after reading the solution i was a bit confused and started building the exact scenario to understand the actual mechanism behind many to one, where i used oracle 11g database. When i am running my project hibernate is generating the tables and FK relations automatically but in the time

resources/hibernate.cfg.xml not found

自古美人都是妖i 提交于 2019-12-24 22:03:58
问题 I am learning to use Hibernate in my Java web app. I have the following sessionFactory started with a configuration for the location of my hibernate.cfg.xml file, but it still complains: resources/hibernate.cfg.xml not found The "resources" folder is a subdirectory of my "src" folder in the java project. public class HibernateUtil { private static final SessionFactory sessionFactory = new Configuration().configure("resources/hibernate.cfg.xml").buildSessionFactory(); public static void main

how to define <element-collection> for a List<String> field?

二次信任 提交于 2019-12-24 21:43:40
问题 If my object has a protected List<String> fileNote; What is the right way to define that relationship in an orm.xml? (note: I do not want to use annotations.) 回答1: Most simple, if you are satisfied with defaults is: <element-collection name="fileNote"/> If more customization is needed, you can go further: <element-collection name="fileNote" fetch="EAGER" access="FIELD/> <column name="some_name_for_column_that_holds_note" /> <collection-table name="descriptive_name_for_table"> <join-column

How to disable JBPM persistance?

大憨熊 提交于 2019-12-24 11:29:59
问题 I'm trying to implement a few tests with JBPM 6. I'm currently working a a simple hello world bpmn2 file, which is loaded correctly. My understading of the documentation ( Click ) is that persistence should be disabled by default. "By default, if you do not configure the process engine otherwise, process instances are not made persistent." However, when I try to implement it, and without doing anything special to enable persistence, I hit persistence related problems every time I try to do

Does NHibernate interoperate with Hibernate? If not is there a framework out there for both Java and .NET?

心不动则不痛 提交于 2019-12-24 11:18:10
问题 Say you had: a database a bunch of .NET Windows GUI programs a bunch of Java web applications you could use Hibernate for the Java stuff and NHibernate for the .NET stuff - but would the two actually interoperate or would they be entirely different stacks? If not then is there a persistence framework out there that lets Java and .NET share business logic? 回答1: I can't talk for the Java people, but from the .NET side of things I believe the mapping files could be shared (xml files describing

Howto work with Properties.CustomSettings

走远了吗. 提交于 2019-12-24 10:48:23
问题 According to MSDN, one can add customized settings files to ones project for convenient management of groups of settings. So I created a custom settings by visual designer, set all properties as a User Scoped to be able to save them.I bind some control properties to this customized settings. And change some values mannually through Properties.CustomSettings.MyValue = x; But when I do Properties.CustomSettings.Default.Save() - nothing happens. The changes are not persisted between application

Data structure that is partially filesystem-backed?

ⅰ亾dé卋堺 提交于 2019-12-24 10:03:04
问题 Is there an existing (Python) implementation of a hash-like data structure that exists partially on disk? Or, can persist specific keys to some secondary storage, based on some criteria (like last-accessed-time)? ex: "data at key K has not been accessed in M milliseconds; serialize it to persistent storage (disk?), and delete it". I was referred to this, but I'm not sure I can digest it. EDIT: I've recd two excellent answers (sqlite; gdb)m; in order to determine a winner, I'll have to wait