-
1. Re: stripersist example on JBoss
tjclifford01 Aug 26, 2011 1:26 PM (in response to zurchman)Sidney:
Did you ever get an answer for your question ?
I'm trying to get the example working on JBoss 5.1.0, and it's telling me:
12:38:35,772 INFO [STDOUT] 12:38:35,769 ERROR Stripersist:82 -
javax.persistence.PersistenceException: [PersistenceUnit: SPERPU] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:678)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:127)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
...more...
Caused by: org.hibernate.HibernateException: Could not find datasource: java:/SPER-DS
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:8
2)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.
java:138)
... 86 more
My xxxxx-ds.xml:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- stripersist JBoss db connection configuration -->
<!-- -->
<!-- ===================================================================== -->
<datasources>
<local-tx-datasource>
<jndi-name>Stripersisttest-DS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>tom</user-name>
<password>(password-for-db)</password>
<min-pool-size>2</min-pool-size>
<!--set this any higher than max_connections on your
MySQL server, usually this should be a 10 or a few
of connections, not hundreds or thousands -->
<max-pool-size>20</max-pool-size>
<!-- Don’t allow connections to hang out idle too long,
never longer than what wait_timeout is set to on the
server...A few minutes is usually okay here,
it depends on your application
and how much spikey load it will see -->
<idle-timeout-minutes>5</idle-timeout-minutes>
<!-- If using Connector/J 3.1.8 or newer, you can use
our implementation of these to increase the robustness
of the connection pool. -->
<exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
<valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
<connection-property name="autoReconnect">true</connection-property>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
[/code]
And my persistence.xml:
[code]
<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_1_0.xsd"
version="1.0">
<persistence-unit name="TestPU">
<jta-data-source>java:/STRIPERSISTTESTDS</jta-data-source>
<class>org.stripersist.example.model.SimpleEntity</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
</properties>
</persistence-unit>
</persistence>
[/code]
[/code]
In my base action bean:
[code]
// ....and my method to get the list of records:
public List<SimpleEntity> getSimpleEntities()
{
ValidationErrors errors = getContext().getValidationErrors();
ArrayList simpleEntities = new ArrayList<SimpleEntity>();
try
{
Query thisq = em.createQuery( "from SimpleEntity" );
simpleEntities = (ArrayList<SimpleEntity>) thisq.getResultList();
}
catch( NullPointerException npe )
{
log.error("Could not get SimpleEntity list!");
return new ArrayList<SimpleEntity>();
}
return simpleEntities;
}
[/code]
Thanks.....Tom C.
-
2. Re: stripersist example on JBoss
zurchman Aug 26, 2011 2:46 PM (in response to tjclifford01)"Not a peep" - in over two months.
I think I even sent a msg to the stripersist author.
The really sad thing is that it's probably something pretty simple.
Thanks!
-
3. Re: stripersist example on JBoss
tjclifford01 Aug 26, 2011 3:26 PM (in response to zurchman)Yeah....that figures.
I've googled stripersist, but there appears little interest in it.
If I find something I'll post it here.