How to use annotation in client application?

2008-11-18 Thread Paul Spencer
I have a EJB3 client application that is not getting the the bean via 
annotation. Getting the bean via the initial context works.


***
* Annotation to get the customerBean
***
  @EJB (name=CustomerBeanRemote)
  private CustomerBean customerBean


1) How do I use annotations, like @EJB, in an EJB3 client?

2) Is their Maven configuration other then a dependency on
   openejb-client that is necessary?

Paul Spencer



Re: Global JNDI Destinations with ActiveMQ

2008-11-18 Thread David Blevins


On Nov 13, 2008, at 12:23 PM, ebmm_axis wrote:



First and foremost, thanks to the openEJB team for all the efforts...

I am running openEJB as a stand alone server and haven't dove into  
it's use

with a full application server.
My reasoning for this is to keep things simple and just learn the  
ins and

outs of OpenEJB.


Using the Default Resource Adapter I am able to use MDBs successfully
throughout my application.
BUT, if I want to access any destination (queue or topic) GLOBALLY  
from a

'stand alone' client, I'm not able to.  (i.e. I would like to globally
resolve via JNDI my JMSConnectionFactory and the queues/topics that  
I have

set up in openejb.xml)

I am failing to connect the dots with the configurations required  
that will

provide the global JNDI name resolution.

Any comments and direction would be much appreciated.





Re: How to maintain a schema per user?

2008-11-18 Thread David Blevins


On Nov 10, 2008, at 2:35 PM, Paul Spencer wrote:


Dain,
I am using OpenJPA.  Do you know if, and how, they support per user  
connections?


OpenJPA will use whatever DataSources we give it.  You might be able  
to use the Commons DBCP PerUserPoolDataSource as Dain suggests but  
it'll take some patching to get it wired in.  This is the class that  
creates the DataSources inside OpenEJB
org.apache.openejb.resource.jdbc.DataSourceFactory


http://svn.apache.org/viewvc/openejb/tags/openejb-3.1/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/DataSourceFactory.java?view=markup

You might be able to patch it to create PerUserPoolDataSource instead.

-David





Paul Spencer


Dain Sundstrom wrote:
Assuming you are using straight JDBC or a persistence framework  
designed for per-user connections, I believe that the  
org.apache.commons.dbcp.datasources.PerUserPoolDataSource pool can  
do what you want, but I've never used per-user pools myself.  Also,  
I bet that c3p0 (http://sourceforge.net/projects/c3p0/) can do it  
also.

-dain
On Nov 10, 2008, at 11:55 AM, Paul Spencer wrote:
I have an application that requires a logged in user be restricted  
to a schema within the database.  For the sake of illustration,  
the application is an address book and their is one schema per  
user.  The database structure of the table and views within each  
schema are exactly same.


My questions:

1) How do insure that a logged in user will only access the data  
in their schema?


2) How can a new schema be automatically created when user is  
created?


Paul Spencer











Re: UserTransaction injection

2008-11-18 Thread David Blevins

On Nov 11, 2008, at 6:57 PM, Carlos MacLeod wrote:

2008-11-12 00:40:55,155 - ERROR - Error merging OpenEJB JNDI entries
in to war /Bunda: Exception: null
java.lang.NullPointerException
   at java.util.Hashtable.put(Hashtable.java:394)
   at  
org 
.apache 
.catalina 
.deploy.NamingResources.addResourceEnvRef(NamingResources.java:320)
   at  
org 
.apache 
.openejb 
.tomcat.catalina.TomcatJndiBuilder.mergeRef(TomcatJndiBuilder.java: 
416)
   at  
org 
.apache 
.openejb 
.tomcat.catalina.TomcatJndiBuilder.mergeJndi(TomcatJndiBuilder.java: 
140)
   at  
org 
.apache 
.openejb 
.tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java: 
270)
   at  
org 
.apache 
.openejb 
.tomcat 
.catalina 
.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:58)


This seems to be the heart of the issue.  Unfortunately looking at the  
code here what might be going on is not obvious.  Is it possible you  
could create a small app that reproduces the problem so we can try it  
on our end?


I've created a JIRA here for it:  
https://issues.apache.org/jira/browse/OPENEJB-960

-David



EntityManager Propagation Problem under 3.1

2008-11-18 Thread JimOR

Apologies in advance for cross-posting, but my post to OpenJPA (
http://n2.nabble.com/EntityManager-Propagation-with-Extended-PersistenceContext-td1495977.html
http://n2.nabble.com/EntityManager-Propagation-with-Extended-PersistenceContext-td1495977.html
)  hasn't gotten any hits.

To repeat from that post, I have:
A) Parent entity with LAZY OneToMany ListChild, cascade:
PERSIST,MERGE,REFRESH
B) Child entity with EAGER ManyToOne Parent, cascade: PERSIST,MERGE,REFRESH

C)Abstract CRUD class with injected Extended PersistenceContext, and
requisite CRUD methods
D) Parent Stateful bean that extends CRUD
E) Child Stateful bean that extends CRUD

Classes are enhanced in place via ant prior to junit test run.

Under OpenEJB3.0 (OpenJPA 1.0.1), Any/All managed entities show as managed
by either bean, but under OpenEJB 3.1 (with deployed OpenJPA 1.1.0 AND
'latest binary' 1.2.0), only the bean responsible for the load/persist/merge
of an entity shows the entity as managed.

The following snippet works fine under 3.0, but throws an exception under
3.1:

Parent p = parentBean.insert(new Parent(Foo));
Child c = childBean.insert(new Child(Bar, p));

WARN
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(Ln
516) - Unexpected exception from beforeCompletion; transaction will roll
back
openjpa-1.1.0-r422266:659716 nonfatal user error
org.apache.openjpa.persistence.ArgumentException: The given instance
entity.Parent-6264 is not managed by this context.
FailedObject: entity.Parent-6264


Please help

Thanks,

Jim



-- 
View this message in context: 
http://www.nabble.com/EntityManager-Propagation-Problem-under-3.1-tp20571571p20571571.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: How to use annotation in client application?

2008-11-18 Thread Manu George
Hi Paul,

If it is a standalone client application with its own main method, it
runs outside the container.So you cannot get beans injected and you
will need to always look them up via remote JNDI lookup

Regards
Manu

On Tue, Nov 18, 2008 at 7:14 PM, Paul Spencer
[EMAIL PROTECTED] wrote:
 I have a EJB3 client application that is not getting the the bean via
 annotation. Getting the bean via the initial context works.

 ***
 * Annotation to get the customerBean
 ***
  @EJB (name=CustomerBeanRemote)
  private CustomerBean customerBean


 1) How do I use annotations, like @EJB, in an EJB3 client?

 2) Is their Maven configuration other then a dependency on
   openejb-client that is necessary?

 Paul Spencer