users@glassfish.java.net

Re: Custom realm using entity beans - is it possible?

From: <glassfish_at_javadesktop.org>
Date: Wed, 26 Sep 2007 09:14:49 PDT

The answer is yes.

I was able to make this work using the above code for my Realm class and application managed persistence. Persistence.xml looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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">
<persistence-unit name="ACL" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
. <class>com.me.security.entities.Account</class>
. <class>com.me.security.entities.Member</class>
. <class>com.me.security.entities.Principal</class>
. <class>com.me.security.entities.Role</class>
. <class>com.me.security.entities.Troop</class>
. <properties>
. <property name="toplink.logging.level" value="WARNING"/>
. <property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/DBName"/>
. <property name="toplink.jdbc.user" value="user"/>
. <property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
. <property name="toplink.jdbc.password" value="password"/>
. </properties>
. </persistence-unit>
</persistence>

The ClassNotFoundException was the result of a bug 3420, the work around for this (adding <property name="toplink.weaving" value="false"/>) did not resolve the problem, but upgrading to V2 b58 did.

Thanks for the help
[Message sent by forum member 'loren_' (loren_)]

http://forums.java.net/jive/thread.jspa?messageID=237194