persistence

Persistent Objects in Windows XP/Delphi 7

不问归期 提交于 2019-11-30 22:55:28
I am trying to make an AlarmSystem in Delphi 7, Windows XP. I have to register alarms in a Database (MS SQL Server 2000). But what if the server is down??? Well, I can imagine that I have to persist objects of TAlarm type. So, how can I do this? Maybe inheriting from TComponent??? Please, how can I do this?? Thanks a lot. I am sorry about my English. Here you have more info... TAlarm is a class that descends from TObject, basically. There are 10 more classes that descend from TAlarm (some types of alarms). TAlarm has a field named FParams : TParams, and the child classes only have an Execute

cannot update class definition in Matlab

巧了我就是萌 提交于 2019-11-30 21:55:36
I am running into an infuriating problem with Matlab, and an earlier answer to apparently the same problem didn't help me, unfortunately. I apologize that the question is rather long - you need quite a bit of information to reproduce the problem (I tried to trim it as much as I could...) The problem is this: No matter what I do, after I have used a class I cannot "make Matlab forget". Values used seem to be persistent, and edits to the class definition won't "stick". In the latter case, the error message is: Warning: The class file for 'myClass' has been changed; but the change cannot be

Can NHibernate persist to flat files instead of database?

余生颓废 提交于 2019-11-30 19:37:11
Here is a curiousity question. I have an application that must support both flat files and the database as a place to persist data. I was thinking maybe using a .csv or tab-delimited set of files as input ... Is it possible to use NHibernate to write to do both persistance tasks? Try using the Jet engine (see this ) Dialect and other nhibernate settings should be the ones for Microsoft Access . No not to the best of my knowledge. I have the same requirement and have ended up just using flat XML files and hand rolling all the CRUD. Just today I did happen to notice this File System Database on

Android Persist Data After Uninstall

徘徊边缘 提交于 2019-11-30 19:16:52
I have to persist 2 strings for my application even after the application is uninstalled. Regarding that the end users don't have SD cards for their devices and they don't have internet connection, how could I persist those 2 strings even after the app is uninstalled? I would highly appreciate any response. Thanks Unless you're targeting VERY old phones, you don't need to worry about not having external storage. As long as you use Environment.getExternalStorageDirectory() as your reference, you shouldn't have a problem, though if you're absolutely concerned about this you can check if the

Can I configure Hibernate/JPA to update an entity record when only non-timestamp fields have been modified?

被刻印的时光 ゝ 提交于 2019-11-30 19:08:48
问题 At the moment I have an Hibernate entity class as follows: @Entity @Table(name = "entity") public class Entity implements Serializable { private static final long serialVersionUID = 2040757598327793105L; @Id @Column private int id; @Column private String data; @Column(name = "last_modified") @Temporal(TemporalType.TIMESTAMP) private Date lastModified; } I've found that even when the non-timestamp fields are not modified (i.e. the data field) a call to merge still updates the timestamp. I

“Type of the parameter must be a class annotated with @Entity” while creating Generic DAO interface in Room

可紊 提交于 2019-11-30 18:58:29
I am using Room architecture component for persistence. I have created generic DAO interface to avoid boilerplate code. Room Pro Tips But my code doesn't compile saying "Error:(21, 19) error: Type of the parameter must be a class annotated with @Entity or a collection/array of it." for the Generic class T. interface BaseDao<T> { @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(T... entity); @Update void update(T entity); @Delete void delete(T entity); } @Dao public abstract class ReasonDao implements BaseDao<ReasonDao> { @Query("SELECT * from Reason") abstract public List<Reason>

How to override FetchType.EAGER to be lazy at runtime

旧时模样 提交于 2019-11-30 18:50:30
Using the JPA EntityManager and the JPA Query object, how can I override something that has the annotation @OneToMany(fetch = FetchType.EAGER) to be fetched lazily in a query? If I had the hibernate Query object, I could have it create a criteria object and using this, set the fetch type to be lazy. But I have to use the JPA Query object. Is there any solution for this problem? There is no way to do that, even with the native Hibernate API. If an association is defined as EAGER, it will always be eagerly loaded, and there's no way to change that using a query. The reverse is not true: you can

cannot update class definition in Matlab

女生的网名这么多〃 提交于 2019-11-30 18:29:05
问题 I am running into an infuriating problem with Matlab, and an earlier answer to apparently the same problem didn't help me, unfortunately. I apologize that the question is rather long - you need quite a bit of information to reproduce the problem (I tried to trim it as much as I could...) The problem is this: No matter what I do, after I have used a class I cannot "make Matlab forget". Values used seem to be persistent, and edits to the class definition won't "stick". In the latter case, the

Mapping calculated properties with JPA

亡梦爱人 提交于 2019-11-30 18:21:22
Is there a way to map a calculated property using JPA? Assuming I have an Invoice object with one or more InvoiceLineItems within it, I want to have a persistent calculated property on the Invoice class that gives me the total amount: class Invoice { ... @Column(name = "TOTAL_AMOUNT") public BigDecimal getTotalAmount() { BigDecimal amount = BigDecimal.ZERO; for (InvoiceLineItem lineItem : lineItems) { amount = amount.add(lineItem.getTotalAmount()); } return amount; } } Now, I could create a protected no-op setTotalAmount method to make JPA happy, but I was wondering if there is a way to let

Can not set java.lang.Integer field to java.lang.Integer

拈花ヽ惹草 提交于 2019-11-30 17:31:08
User declaration: @Entity public class User { @Id @GeneratedValue private Integer id; .... Pattern declaration: @Entity public class Pattern { @Id @GeneratedValue Integer id; ... UserPatternDeclaration: public class UserPattern { @Id @GeneratedValue Integer id; @ManyToOne @JoinColumn(name = "user_id") User user; @ManyToOne @JoinColumn(name = "pattern_id") Pattern pattern; ... request to database: Session session = sessionFactory.getCurrentSession(); Query query = session.createQuery("from UserPattern where user = :user_id and pattern = :pattern_id "); query.setParameter("user_id", userId);