
Get Started with github (EN)
Nous préparons une version vidéo et en français dès que terminé la présentation sera publié sur ce site.
(en) A lebanese Java User Group at Cnam Liban university. Articles in English or French. (fr) Groupe d'utilisateurs Java Liban. Articles en français ou anglais. This blog is the index toward contents (in general) on others sites. It helps the Group to stress on current activities.
asadmin change-admin-password --domain_name domain1
asadmin enable-secure-admin --port 4848
mvn --version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T14:57:37+03:00)
Maven home: /opt/apache-maven-3.3.3
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "3.19.0-30-generic", arch: "amd64", family: "unix"
mvn archetype:generate -DgroupId=net.cofares.tuto -DartifactId=appNo1 -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: net.cofares.tuto
[INFO] Parameter: packageName, Value: net.cofares.tuto
[INFO] Parameter: package, Value: net.cofares.tuto
[INFO] Parameter: artifactId, Value: appNo1
[INFO] Parameter: basedir, Value: /home/pascalfares
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /home/pascalfares/appNo1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.397 s
[INFO] Finished at: 2015-10-18T10:31:03+03:00
[INFO] Final Memory: 17M/158M
[INFO] ------------------------------------------------------------------------
more pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/
maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.cofares.tuto</groupId>
<artifactId>appNo1</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>appNo1</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| String dbURL = "jdbc:mysql://localhost:3306/sampledb" ; String username = "root" ; String password = "secret" ; try { Connection conn = DriverManager.getConnection(dbURL, username, password); if (conn != null ) { System.out.println( "Connected" ); } } catch (SQLException ex) { ex.printStackTrace(); } |
By default EclipseLink enables a shared object cache to cache objects read from the database to avoid repeated database access. If the database is changed directly through JDBC, or by another application or server, the objects in the shared cache will be stale.
EclipseLink offers several mechanism to deal with stale data including:
- Refreshing
- Invalidation
- Optimistic locking
The shared cache can also be disabled. This can be done using the EclipseLink persistence unit property:
- Cache coordination
<property name="eclipselink.cache.shared.default" value="false"/>Or the JPA 2.0 persistence unit element:
<shared-cache-mode>NONE</shared-cache-mode>
Or can be selectively enabled/disabled using the@Cache
annotation:
@Entity@Cache(isolation=ISOLATED)public class Employee { ...
}Or the JPA 2.0@Cacheable
annotation:
@Entity@Cacheable(false)public class Employee { ...
}Do not disable the cache by setting theCacheType
toNone
, this can cause object identity issues.