Anfängerfrage: EJB 3.0 Deployment error

Status
Nicht offen für weitere Antworten.

JRoxx

Mitglied
hallo,

beim Deployen von einer EJB bekomme ich von JBoss den folgenden fehler:

persistence.unit:unitName=#MyEJBProject -> org.hibernate.HibernateException: Hibernate Dialect must be explicitly set


hier mal die 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="MyEJBProject">
	<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<jta-data-source>java:/mydatasource</jta-data-source>
		<properties>
			<property name="hibernate.hbm2ddl.auto"
			value="create-drop"/>
		</properties>
	</persistence-unit>
</persistence>

danke für ratschläge.

Gruß
 

JRoxx

Mitglied
ok hab ne property hinzugefügt.
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect"/>

scheint nun zu klappen das deployment
 

JRoxx

Mitglied
scheint aber trotzdem noch nicht zu funktionieren, wenn ich den folgenden client ausführe kommt:

AdressTestBean not bound.

Code:
public class MyEJBClient {
	
	public static void main(String[] args)
	{
		
		Context context;
		Hashtable env = new Hashtable();

		// Setzen der JBoss JNDI-Factory
		env.put(Context.INITIAL_CONTEXT_FACTORY,
		"org.jnp.interfaces.NamingContextFactory");
		
		// URL des Namensdienstes (JBoss-Standard-Port: 1099)
		env.put(Context.PROVIDER_URL, "localhost:1099");
		
		try
		{
			context = new InitialContext(env);
			AdresseTestBeanRemote beanRemote = (AdresseTestBeanRemote)
			context.lookup("AdressTestBean/remote");
			beanRemote.test();
		} 
		catch (NamingException e)
		{
			e.printStackTrace();
			
			throw new RuntimeException(e);
		}
	}

}

passt der client so?
 

JRoxx

Mitglied
Hier mal noch die Datasource und die Bean Klasse:

Code:
<?xml version="1.0" encoding="UTF-8"?>
	<datasources>
		<local-tx-datasource>
			<jndi-name>mydatasource</jndi-name>
			<connection-url>jdbc:mysql://127.0.0.1:3306/test</connection-url>
			<driver-class>com.mysql.jdbc.Driver</driver-class> 
			<user-name>***</user-name>
			<password>***</password>
		</local-tx-datasource>
	</datasources>


Code:
public class AdresseTestBean implements AdresseTestBeanLocal, AdresseTestBeanRemote {

	@PersistenceContext
	EntityManager em;
	
	public static final String RemoteJNDIName = AdresseTestBean.class.getSimpleName() +
	"/remote";
	public static final String LocalJNDIName = AdresseTestBean.class.getSimpleName() +
	"/local";
	
	@Override
	public void test() {
		
		Adresse a1 = new Adresse("dfsfds","fdsf","bannjhjtfrr",30);
		Adresse a2 = new Adresse("fdsfdsgdf","fdsf","baizstr",30);
		Adresse a3 = new Adresse("fdsgfgds","fdsfdsg","bafdf",30);
		
		em.persist(a1);
		em.persist(a2);
		em.persist(a3);
		
	}
}
 

Ceene

Aktives Mitglied
Ich arbeite selber nicht mit Hibernate aber ich habe ebb Beispiel von Hibernate wo noch weitere Properties übergeben werden. Vielleicht helfen dir die weiter.

Code:
<persistence-unit name="TC_Dialogpflege">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/OracleDS</jta-data-source>
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
         <property name="hibernate.transaction.flush_before_completion" value="true"/>
         <property name="hibernate.hbm2ddl.auto" value="validate"/>
         <property name="hibernate.show_sql" value="true"/>
      </properties>
   </persistence-unit>
 
Status
Nicht offen für weitere Antworten.

Ähnliche Java Themen

Neue Themen


Oben