Java Desktop Applications – switch propertie from a JPA persistent unit at runtime

Java Desktop Applications – switch propertie from a JPA persistent unit at runtime

HashMap propertiesMap; javax.persistence.EntityManager entityManager; propertiesMap = new HashMap(); propertiesMap.put(“toplink.jdbc.password", “password"); propertiesMap.put(“toplink.jdbc.url", “url"); entityManager = javax.persistence.Persistence.createEntityManagerFactory(“persistencePU", propertiesMap).createEntityManager();

Today on java.net

Java.net

Today on java.net August 25, 2009

New java.net Infrastructure: Working on Day One Issues
I don’t think it will surprise too many people that, on the first day when large segments of new underlying infrastructure are brought live on a relatively large and complex web site, a few unanticipated issues reveal themselves…

Java Today

Fake Java properties and how they improve JPA

Fake Java properties and how they improve JPA « Just listen to Alex

Fake Java properties and how they improve JPA
Filed under: programming — Tags: java, jpa — bosmeeuw @ 5:52 pm

It doesn’t look like Java will be getting real property support in our lifetimes. This is too bad, because being able to refer to properties of an object in a type-safe way is really valuable when developing applications with a large domain. Take a gander a this JavaBean:

JPA Performance, Don’t Ignore the Database

JPA Performance, Don’t Ignore the Database | Java.net

JPA Performance, Don’t Ignore the Database
Database Schema
Good Database schema design is important for performance. One of the most basic optimizations is to design your tables to take as little space on the disk as possible , this makes disk reads faster and uses less memory for query processing.

Data Types
You should use the smallest data types possible, especially for indexed fields. The smaller your data types, the more indexes (and data) can fit into a block of memory, the faster your queries will be.

Normalization
Database Normalization eliminates redundant data, which usually makes updates faster since there is less data to change. However a Normalized schema causes joins for queries, which makes queries slower, denormalization speeds retrieval. More normalized schemas are better for applications involving many transactions, less normalized are better for reporting types of applications. You should normalize your schema first, then de-normalize later. Applications often need to mix the approaches, for example use a partially normalized schema, and duplicate, or cache, selected columns from one table in another table. With JPA O/R mapping you can use the @Embedded annotation for denormalized columns to specify a persistent field whose @Embeddable type can be stored as an intrinsic part of the owning entity and share the identity of the entity.