persistence

How can I get the filtered model?

你离开我真会死。 提交于 2019-11-29 13:49:41
I'm working with JTables to display information that users can filter, and if the user saves after filtering I want to save the filtered table to a textfile for persistence (meaning anything that got filtered out will not be saved to the textfile). For filtering I just followed the filtering part of this tutorial: http://download.oracle.com/javase/tutorial/uiswing/components/table.html#sorting and it works fine, but I'm not sure of any way that I can get a model of the current display as opposed to the underlying model that contains everything that hasn't been filtered out. Is there any way to

jpa error uses a non-entity [class ch.printsoft.mailhouse.usermgr.entity.Department] as target entity in the relationship attribute

ぐ巨炮叔叔 提交于 2019-11-29 13:28:31
I try to persist my Department and Mandator classes to hsqhldb but it gives this error. Exception Description: [class ch.printsoft.mailhouse.usermgr.entity.Mandator] uses a non-entity [class ch.printsoft.mailhouse.usermgr.entity.Department] as target entity in the relationship attribute [field departments]. at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:115) at javax.persistence

Error on compiling query: The abstract schema type 'entity' is unknown

寵の児 提交于 2019-11-29 12:26:06
问题 I'm developing a game with a database connection, and I use JPA to persist my data. Here is my Game entity : @Entity @Table(name = "game") public class Game implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "game_id") private int id; @Column(name = "name") private String name; @Column(name = "nbTurns") private int nbTurns; @Column(name = "playedOn") @Temporal(TemporalType.TIMESTAMP) private Date

Best practice for sharing data between pages

↘锁芯ラ 提交于 2019-11-29 10:05:19
I was wondering what the best practice is for sending variables like 'selectedItem' and so on between pages in UWP? Is it a good idea to just create a static global variable class that every Page knows of? I'm going to sum up Microsofts Best Practice here: For simple data (like strings): Use the Frame.Navigate(TypeName, Object) method, where as the second argument should always be a string (even if it allows objects). The second argument can then be extracted from the NavigationEventArgs.Parameter in the Frame.Navigated event handler. For complex data (anything besides strings): You may choose

How to handle several DB schemas with Hibernate?

左心房为你撑大大i 提交于 2019-11-29 08:47:01
In one of my projects, I have an application that manages several clients (or customer if you prefer). For each of them, I have a dedicated schema on a database. However, the application handles only one client at a time, i.e. the user must switch from one client to another in the application (at runtime, no restart of the application) in order to access the data from this new client. How would you manage the connections, as well as the persistence layer, for this kind of project? I want to use Hibernate for that. What are the points on which I must be really carefull when dealing with several

Hibernate/JPA: Is it possible to retrieve heterogeneous entities in a single query?

╄→гoц情女王★ 提交于 2019-11-29 08:03:14
I have 2 entities: EntityA and EntityB. They are unrelated, and I cannot put them in a Inheritance tree for some restrictions out of the scope of this question. But I need to get in the same JPQL or HQL query a mixed List containing all the instances of both entities. Is this possible with JPA or even Hibernate directly? I need somethign like this: FROM EntityA WHERE fieldA=1 UNION FROM EntityB WHERE fieldB="aa" Any hint? Well, I finally figured it out. It is enought to make the entities implement a common interface (it is not even needed to declare this interface on Hibernate). Then, a query

How solve javax.persistence.EntityNotFoundException with JPA (not by using @NotFound)

我只是一个虾纸丫 提交于 2019-11-29 07:53:56
问题 We are using JPA to load some stuff from a database. Some entities may have optional relationships between them, e.g. @Entity public class First { .... @OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH}) @JoinColumns(value = { JoinColumn(name = "A_ID", referencedColumnName = "A_ID", insertable = false, updatable = false), JoinColumn(name = "B_ID", referencedColumnName = "B_ID", insertable = false, updatable = false)}) private Second second;

Handling persistent user-specific values in Gmail Add-ons

馋奶兔 提交于 2019-11-29 07:19:41
I have created simple Gmail addon, now I'm struggling with below strategies. After installing the addon, when first inbox is opened, we ask basic info input from users, when he opens second mail we won't ask basic info details again. How I can handle this? I have tried property service but no luck. Update var MAX_THREADS = 5; /** * Returns the array of cards that should be rendered for the current * e-mail thread. The name of this function is specified in the * manifest 'onTriggerFunction' field, indicating that this function * runs every time the add-on is started. * * @param {Object} e data

How to have 2 collections of the same type in JPA?

99封情书 提交于 2019-11-29 06:46:04
问题 I've got 2 entities in JPA: Entry and Comment. Entry contains two collections of Comment objects. @Entity public class Entry { ... @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @IndexColumn(base = 1, name = "dnr") private List<Comment> descriptionComments = new ArrayList<Comment>(); @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @IndexColumn(base = 1, name = "pmnr") private List<Comment> postMortemComments = new ArrayList<Comment>(); ... } To store such

AnnotationException: A Foreign key refering has the wrong number of column. should be 2

放肆的年华 提交于 2019-11-29 06:20:49
问题 I am mapping my classes with the tables of my database, but when running a test, I get the following error: Caused by: org.hibernate.AnnotationException: A Foreign key refering com.modulos.pvs.acceso.datos.entity.Provincia from com.modulos.pvs.acceso.datos.entity.Ciudad has the wrong number of column. should be 2 at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:429) at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:115) at org.hibernate.cfg