persistence

How can I identify a particular computer on my website without cookies (just like Twitter does)?

可紊 提交于 2019-12-06 11:48:36
I'm looking to identify each computer that accesses my website independent of cookies. I know it can be done because Twitter does it. Here's proof: Reset a browser (no cookies, no cache, total reset) Visit twitter.com Note the value of newly added _twitter_sess cookie Repeat Steps 1 - 3. Cookie _twitter_sess will have the same value as before Change IP addresses Repeat Steps 1 - 3. Cookie _twitter_sess will have the same value as before Change Browsers Repeat Steps 1 - 3. Cookie _twitter_sess will have the same value as before Change User Agents Repeat Steps 1 - 3. Cookie _twitter_sess will

Deployed war to tomcat can't throws java.lang.NoClassDefFoundError: javax/persistence/PersistenceException

强颜欢笑 提交于 2019-12-06 11:18:51
I'm new to this forum and also new to JPA / EJB. I'm trying to deploy a .war file containing a small application to a tomcat server. The application is using JTA to communicate with the Derby db. When I run and deploy the application from and eclipse top the tomcat server running in eclipse, everything works perfect, but when I export a .war file and try to browse the application it throws an java.lang.ClassNotFoundException: javax.persistence.PersistenceException. My persistence file looks like this: <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns

java beans: difference between persistent field and persistent property?

被刻印的时光 ゝ 提交于 2019-12-06 10:59:18
问题 I got the impression that if we use persistent fields, there is no need for getter methods since the entity manager references the instance variables directly. However, when I removed the getter and setter methods from an entity to have persistent fields, the values for the corresponding instance variable was not retrieved from the database! Does that mean we must have getter and setter methods even though we have persistent fields? 回答1: If the entity class uses persistence, fields

Hibernate LazyInitializationException on find() with EAGER @ElementCollection

怎甘沉沦 提交于 2019-12-06 08:23:42
I am getting org.hibernate.LazyInitializationException: illegal access to loading collection in my JPA code - all collections are EAGER fetch - when the collection entity also has a collection. Could somebody please help me to fix this? I have isolated a problem in my JPA code to the following @Entity definitions: (note, I'm skipping the package and import statements to shorten the code. Some Lombok annotations are used, such as @Data to mean that the field has a getter/setter and @Cleanup to do the usual try/catch close() dance) @Entity @Data public class MyEntity implements Serializable {

Hibernate Query to fetch records on date ignoring timestamp

岁酱吖の 提交于 2019-12-06 07:04:08
I have a timestamp column tradedate in one of the DB(Oracle) tables. I am using hibernate as the persistence layer to fetch and store Data to DB. I have a requirement in which I need to query the DB on date. i.e From UI the user passes a date and I need to get the filtered data based on this date. If the tradedate column only has the date part my query returns the correct records The issue arises when the tradedate column is populated with a timestamp value ie(date + time). Then those values are not returned by the query. eg:say there are 10 records for 23rd Oct 2010 in DB 5 of them have the

Bitronix + Spring + Hibernate + Persistence

天大地大妈咪最大 提交于 2019-12-06 06:25:53
I am trying to create transaction manager and use it with Hibernate for Oracle. My persistence.xml file is: <persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>jdbc/testDS1</jta-data-source> <class>org.drools.persistence.session.SessionInfo</class> <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class> <class>org.drools.persistence.processinstance.WorkItemInfo</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="hibernate.dialect" value

ASP.NET MVC Session usage

孤街醉人 提交于 2019-12-06 06:22:19
Currently I am using ViewData or TempData for object persistance in my ASP.NET MVC application. However in a few cases where I am storing objects into ViewData through my base controller class, I am hitting the database on every request (when ViewData["whatever"] == null). It would be good to persist these into something with a longer lifespan, namely session. Similarly in an order processing pipeline, I don't want things like Order to be saved to the database on creation. I would rather populate the object in memory and then when the order gets to a certain state, save it. So it would seem

Does Java have something similar to Cocoa's NSUserDefaults?

▼魔方 西西 提交于 2019-12-06 06:20:13
问题 Mac OS X and iOS have a nice little class called NSUserDefaults . It's a singleton that lets you store strings, arrays, and primitives, and you can always implement some methods to add custom objects to it. It's super useful when you need to store a quick setting without dealing with file manipulations (for example, storing the last picked font name). Does Java have something simple like this? I'd like to be able to store a user's last settings to reload a similar state when the program

How to cascade persist only new entities

爱⌒轻易说出口 提交于 2019-12-06 06:14:05
问题 I'm having trouble figuring out how to set up JPA persistence (using EclipseLink and transaction-type="RESOURCE_LOCAL") correctly for the following entities: @Entity public class User { // snip various members @ManyToMany private List<Company> companies; public void setCompanies(List<Company> companies) { this.companies = companies; } } @Entity public class Company { // snip various members } What I'm trying to do is set up a cascade for the companies list so that, if a new Company that hasn

how to make openjpa 2.2.0 not persist foreign key

↘锁芯ラ 提交于 2019-12-06 02:47:54
I have two tables.. Asset table ASSET_ID SYSIBM INTEGER 4 0 No USER_ID SYSIBM INTEGER 4 0 No ASSET_TYPE_ID SYSIBM SMALLINT 2 0 No ACCESSIBILITY_ID SYSIBM SMALLINT 2 0 Yes DOWNLOAD_TYPE_ID SYSIBM SMALLINT 2 0 No ASSET_STATUS_ID SYSIBM SMALLINT 2 0 No ASSET_MARKETING_ID SYSIBM SMALLINT 2 0 Yes ASSET_PI_SPI_ID SYSIBM SMALLINT 2 0 Yes and the Accesibility table ACCESSIBILITY_ID SYSIBM SMALLINT 2 0 No ACCESSIBILITY_DESC SYSIBM VARCHAR 50 0 No i have two beans, Asset Bean @Column(name="ASSET_ID") @GeneratedValue(strategy=GenerationType.IDENTITY) private int assetId; @Column(name="DATE_CREATED")