2012-02-04T14:08:22CET
Vegard
Hi. It's been a while since you wrote this and I'm guessing you've figured out how to attach the JavaDoc to the project, but in case other people wonder, here's how I did it i...more
2011-11-23T12:00:35CET
xsalefter
Hi.. "Learning a new build tool is not going to make your application code better or helping you finish your work." Agree with this.. The same feeling applied to me 1 year ...more
2011-08-06T15:38:27CEST
Christian Bauer
The quality of JTA has been a major but hidden factor why Java EE has a heavyweight reputation. I remember saying that if JTA and JNDI APIs weren't as horrible as they are, Sp...more
2011-08-06T13:50:32CEST
Ludovic Orban
You may be interested in reading http://blog.bitronix.be/2011/02/why-we-need-jta-2-0/ . You're one of the very few people who seem to grasp the true essence of JTA as you prov...more
2011-08-02T07:49:30CEST
Christian Bauer
Turns out I was wrong, evercookie is actually being used: http://www.wired.com/epicenter/2011/07/undeletable-cookie/ What we need is a whitelist in our browsers for any kind ...more
2011-07-31T07:55:39CEST
Guy
Atomikos should work too: http://www.atomikos.com/Main/TransactionsEssentials Bestmore
2011-10-20T10:44:53CEST
[UI, Web, HTML, CSS]
Christian Bauer

Some notes on how to create an HTML interface that works with all kinds of screen sizes popular today, no matter if it's workstation or portable. This solution relies on pure HTML/CSS, so IE6/7/whatever are out.


2011-10-18T14:19:25CEST
[Info]
Christian Bauer

Regular visitors might notice some changes to the website and projects. The big news is that we are now incorporated as 4th Line GmbH in Switzerland. We are a team of software and IT systems experts offering a range of services, with a focus on Free Software. If you need help with any of our projects, contact us.

This website/domain then has also been renamed, the "Teleal" name is no more. All software and code has been updated to reflect this name change, this means that package names also have to be updated, from org.teleal to org.fourthline. The shared code of teleal-commons is now much improved available under seamless.org, a domain we'll use more in the future for utilities, frameworks, and (CDI) components.

The Cling project was updated to version 2.0, there will be no 1.1. More work is needed before a first beta release though. The license was changed from LGPLv3 to LGPLv2, as we had some concerns about patent licensing clauses. I'm reasonably sure we can't make the lawyers go away by fighting them with the v3 GPL patent clause, so in this case I'm more interested in spreading the software.

A new previously announced project has been released, Konto. This is a basic and elegant accounting system, really just a no-nonsense double entry general ledger with some reporting. Check it out, it is available under AGPLv3 and there is a demo server.

Finally, all source code moved from Subversion to github. We'll also start using their issue tracker, as we continue to grow.


2011-07-30T15:36:00CEST
[Hibernate, JTA, JDBC, connection pool]
Christian Bauer

If all you want is Hibernate/JPA and a database connection pool, pick one that is JTA compatible. I've only just now found Bitronix and it looks great.

Put this in your pom.xml:

<repository>
    <id>jboss-repo</id>
    <url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>

<dependency>
    <groupId>org.codehaus.btm</groupId>
    <artifactId>btm</artifactId>
    <version>2.1.1</version>
</dependency>

<dependency>
    <!-- ORCL can't be bothered to update javax.persistence in Maven central but
         I hear great things about their new sailboat -->
    <groupId>org.hibernate.javax.persistence</groupId>
    <artifactId>hibernate-jpa-2.0-api</artifactId>
    <version>1.0.1.Final</version>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.6.6.Final</version>
    <exclusions>
        <!-- Javassist does the job -->
        <exclusion>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Hibernate and the JTA manager will communicate through JNDI (don't get me started), so put a jndi.properties file on your classpath to enable the bundled minimal implementation:

java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory

Next configure and start the JTA manager and connection pool - see the Bitronix website if you want to do this with property files instead of code:

// Each JVM needs a stable unique identifier for TX recovery
TransactionManagerServices.getConfiguration().setServerId("myServer1234");

// Create the datasource and set the connection pool details
PoolingDataSource datasource = new PoolingDataSource();
datasource.setUniqueName("myDS");
datasource.setMinPoolSize(5);
datasource.setMaxPoolSize(25);
datasource.setPreparedStatementCacheSize(50);

// If you use Hibernate's hbm2ddl.auto mode, on startup SchemaExport executes
// connection.setAutoCommit(true) to export DDL. This is a non-XA transaction.
// Alternatively, wrap UserTransaction.begin() and commit() around your Hibernate
// startup code.
datasource.setAllowLocalTransactions(true);

// This is for H2 DBMS, which I really like for small scale use
datasource.setClassName("org.h2.jdbcx.JdbcDataSource");
datasource.getDriverProperties().put("URL", "jdbc:h2:mem:myTemporaryDB");
// H2 doesn't need a password for temporary in-memory databases
//datasource.getDriverProperties().setProperty("user", "scott");
//datasource.getDriverProperties().setProperty("password", "tiger");

// Create pool, bind datasource to JNDI
datasource.init();

Now set the datasource name for JNDI lookup in JPA's META-INF/persistence.xml and configure how Hibernate should lookup the transaction manager:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                                 http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">

    <persistence-unit name="myPU">
        <jta-data-source>myDS</jta-data-source>
        <properties>

            <property name="hibernate.dialect"
                      value="org.hibernate.dialect.H2Dialect"/>

            <property name="hibernate.transaction.manager_lookup_class"
                      value="org.hibernate.transaction.BTMTransactionManagerLookup"/>

            <property name="hibernate.hbm2ddl.auto"
                      value="create"/>

        </properties>
    </persistence-unit>

</persistence>

Finally, start JPA and write units of work with EntityManagers:

Context ctx = new InitialContext();
EntityManagerFactory emf = Persistence.createEntityManagerFactory("myPU");

UserTransaction tx = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
tx.begin();

EntityManager em = emf.createEntityManager();
em.persist();
em.createQuery();

tx.commit();

That's neat. Now can we get rid of JNDI and have someone competent redesign the JTA API, please?

(I've tried Emmanuel's guide for standalone usage of JBoss TS but the dependencies are just too scary. I don't trust a transaction manager runtime that depends on a diagram drawing library or a test coverage tool. No, it's not fixed in the latest version. If the implementation code looks like the build setup...)


1to3of44nextend

Creative Commons License