persistence

Understanding Service and DAO layers

南笙酒味 提交于 2019-12-12 12:16:23
问题 I was asked to create documentation of classes in the business logic module of a project. I noticed that there was a pattern on how the classes where created. The pattern looks like this public class AModel(){ //fields //getter and setters } public class AService(){ public void processA(AModel model){ //creates instance of AModel, assigns values to fields //calls ADaoService methods } } public class ADaoService(){ //has methods which call ADao methods //sample public AModel retrieveById(long

Persisting @OneToMany relations with @JoinColumn and @MapKeyColumn

心不动则不痛 提交于 2019-12-12 12:02:01
问题 I have two entities: @Entity Article { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL) @JoinColumn(name="embed_id", referencedColumnName="id") @MapKeyColumn(name = "language") @MapKeyEnumerated(EnumType.ORDINAL) private Map<Language, Locale> locales; Article() { locales.put(Language.CS, new Locale()); locales.put(Language.EN, new Locale()); } } @Entity Locale { @Id private Long embed_id; @Id private Language

JPA EntityManager and JavaFx [duplicate]

一世执手 提交于 2019-12-12 10:24:23
问题 This question already has an answer here : Can't create a EntityManager in JavaFx (1 answer) Closed 6 years ago . I tried to use EntityManager in a JavaFx application in NetBeans (my solution is connected to postgres), I proceeded as follows : 1) I created a Persistence Unit. 2) Then Added the Entity Classes from Database. but I can't get it to work, I tried to ask for some help in another thread Entity Manager not working in JavaFX but can't get it work either, is there any clean and clear

Advice on High Score persistence (iPhone, Cocoa Touch)

不羁岁月 提交于 2019-12-12 09:08:52
问题 I was curious what is considered the better way to manage the reading and writing of a High Score plist file. My High Score class is: @interface HighScore : NSObject <NSCoding> { NSString *name; int score; int level; int round; NSDate *date; } Now, I could do method A, add NSCoding methods: - (void) encodeWithCoder: (NSCoder *) coder { [coder encodeObject: name forKey: kHighScoreNameKey]; [coder encodeInt: score forKey: kHighScoreScoreKey]; [coder encodeInt: level forKey: kHighScoreLevelKey];

Jboss 7 not Creating Persistence Unit

你说的曾经没有我的故事 提交于 2019-12-12 09:08:27
问题 I use Jboss 7 , hibernate 4.1.5 FINAL and Spring 3.1.2 for my application Caused by: javax.persistence.PersistenceException: [PersistenceUnit: Virtuoso] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) at org.jboss

Storing state in Java

那年仲夏 提交于 2019-12-12 07:18:34
问题 Broad discussion question. Are there any libraries already which allow me to store the state of execution of my application in Java? E.g I have an application which processes files, now the application may be forced to shutdown suddenly at some point.I want to store the information on what all files have been processed and what all have not been, and what stage the processing was on for the ongoing processes. Are there already any libraries which abstract this functionality or I would have to

'java.lang.NoSuchFieldError' while using the JPA

丶灬走出姿态 提交于 2019-12-12 06:54:01
问题 I am getting the following error while trying out this JPA tutorial: java.lang.NoSuchFieldError: NONE at org.hibernate.ejb.QueryImpl.<init>(QueryImpl.java:609) at org.hibernate.ejb.QueryImpl.<init>(QueryImpl.java:80) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272) at entity.PersonTest.insertAndRetrieve(PersonTest.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

Android HashMap not persisting when returning to activity

烂漫一生 提交于 2019-12-12 06:50:11
问题 I am trying to keep my HashMap values when I navigate to another activity and return. This is the code I have for now. The HashMap works and is able to grab and save the data from the EditText in the view. However as soon as I leave from the activity and return, the HashMap is reinitialized to empty -> {} I have looked at documentation and it seems this is the correct way of ensuring that a variable data is persisted. However it does not work. please let me know what could be the issue:

Persisting a datasource between multiple views without shared root view controller

一曲冷凌霜 提交于 2019-12-12 05:39:51
问题 I'm currently working on an app that uses a UINavigationController inside UITabBars . The tab bars correspond to both UITableViews as well as a Map View. However, the root view controller of the app is not the parent, or direct parent, of the UITableView custom controllers and map view controller. I also have a p-list that creates NSDictionary objects; it is the datasource that I am using to populate entries in the tables and the map. So, without a root view controller, how should I create

Persisting GridView data across PostBacks?

只愿长相守 提交于 2019-12-12 05:39:12
问题 Alright, so here's my basic ASP.NET page setup: I've got a page with a GridView that has ContentTemplates in it. You can add a row and edit/remove rows at any time. There's a "New" button that creates a new row. All of this data is bound to custom data objects. So if I have a GridView of "People" and each row has "FirstName", "LastName", and "Gender" (with TextBox and DropDown controls), I then have a "Person" object which has public properties for "FirstName", "LastName", etc. I have the