persistence

EclipseLink - non Entity as target entity in the relationship attribute

偶尔善良 提交于 2019-12-07 09:25:20
问题 I am using the Netbeans IDE 8.0.2 and eclipselink 2.5.2. This occurring exception below when opening a connection, the problem is that this does not happen every time. The entity described in exception "Departmento" exactly follows the pattern of the other classes being that our system already contain approximately 500 entity classes and only in the new classes are taking place this exception. This entity was generated by that option "Entity Classes from Database" of Netbeans and added to the

Creating a Persistent Data Object In Django

余生颓废 提交于 2019-12-07 09:21:24
问题 I have a Python-based maximum entropy classifier. It's large, stored as a Pickle, and takes about a minute to unserialize. It's also not thread safe. However, it runs fast and can classify a sample (a simple Python dictionary) in a few milliseconds. I'd like to create a basic Django web app, so users can submit samples to classify in realtime. How would I load the classifier into persistent memory once , and then regulate it so that each request can access the object without conflicting with

Handling class changes when using ORM such as ODB

牧云@^-^@ 提交于 2019-12-07 07:00:24
问题 I am looking into using an ORM (Objection Relational Mapper) to allow me to persist my C++ objects into an SQLite database. I'm currently considering ODB by CodeSynthesis. See: http://www.codesynthesis.com/products/odb/ Looking at the docs for ODB, I don't see an answer to a nagging question I have, which is: What happens if I create a class, persist it to the DB, but then in a later version of my product change the class. When the user gets the new version of my software, how will the old

Using JPA with Hibernate implementation: entityManager.remove - not working

好久不见. 提交于 2019-12-07 06:35:14
问题 I am using JPA over Hibernate 4.1.4.Final implementation. My problem is that I can't get EntityManager#remove() working. All other: update, insert, select operation are working just fine except this one. My persistence.xml file: <persistence-unit name="myEntityManager"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>core.entity.Answer</class> <class>core.entity.BaseEntity</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <validation-mode>NONE</validation

How can I validate constrains on entities during persist of an entity in hibernate

假装没事ソ 提交于 2019-12-07 06:25:40
问题 I have an entity with a field name, and I want it to be not longer than 255, so I defined it like this: @Entity public class A implements Serializable { ... @NotNull @Size(max=255) private String name; I want it to be validated as I call a.persist(), so that if name is too long an exception is thrown. I have HibernateValidator defined in validation.xml: <?xml version="1.0" encoding="UTF-8"?> <validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration" xmlns:xsi="http:/

Why is isolated storage not persisting in my WP7 application?

陌路散爱 提交于 2019-12-07 05:34:25
I am using IsolatedStorageSettings.ApplicationSettings for my application. All code associated with Isolated storage occurs in my Application_Launching, Application_Activated, Application_Closing, and Application_Deactivated methods as follows: public IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; private void Application_Launching(object sender, LaunchingEventArgs e) { if (settings.Contains("myObjList")) { App.ObjList = (ObservableCollection<myObj>)settings["myObjList"]; } else { settings.Add("myObjList", App.ObjList); } } private void Application_Activated

How do you set the schema name for sequences at deploy time when using JPA?

可紊 提交于 2019-12-07 05:29:59
问题 For security reasons, our oracle db objects normally belong to a different schema than the logged in user. Eg. tables are in xx_core and the user we log in is xx_app_yy . In my persistence.xml I define a orm file so that I can specify the schema name at deploy time eg.: <mapping-file>xx_schema_orm.xml</mapping-file> Then in the xx_schema_orm.xml I can define the object-owning-schema eg.: <persistence-unit-metadata> <persistence-unit-defaults> <schema>xx_core</schema> </persistence-unit

Is query to new added object possible in MS Entity Framework

北战南征 提交于 2019-12-07 04:46:45
问题 Is there a way to query or just access newly added object (using ObjectContext.AddObject method) in Entity Framework? I mean situation when it is not yet saved to data store using SaveChanges I understand that queries are translated to underlying SQL and executed against data store, and it don't have this new object yet. But anyway, I'm curious - if it is not oficially supported, maybe it is possible in theory. If it's not, how developer can deal with it? Manually track new objects and query

Should embeddable jpa class implement equals and hashCode?

为君一笑 提交于 2019-12-07 04:30:43
问题 Let's say I have the following scenario: @Entity public class Person { @Id private Long id; //Surrogate key @Embedded private Name name; //Natural key public int hashCode() { ... //based on natural key Name } public boolean equals(Object obj) { ... //based on natural key Name } } @Embeddable public class Name { private String firstName; private String middleName; private String lastName; //Should I implement equals/hashCode baseed on the three fields? } Should Name class implement equals and

Hibernate + oracle sequence + trigger

独自空忆成欢 提交于 2019-12-07 03:11:46
问题 I have a table with an index auto filled by a trigger that use a sequence (Oracle database) CREATE TABLE A ( IDS NUMBER(10) NOT NULL ) CREATE OR REPLACE TRIGGER A_TRG BEFORE INSERT ON A REFERENCING NEW AS New OLD AS Old FOR EACH ROW BEGIN :new.IDS := A_SEQ.nextval; END A_TRG; / I have a matching Java class: Class A { @Id @SequenceGenerator(name = "aSequence", sequenceName = "A_SEQ", allocationSize = 1) @GeneratedValue(generator = "aSequence", strategy = GenerationType.SEQUENCE) @Column(name =