Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-22 Thread eialbur
Sorry for the quantity of my questions, and I apologize in advance if any of
them are trivial or stupid.


ok - so I guess that in my Session Bean I would use the regular old
@Resource annotation:
@Resource
GraphDatabaseService graphDb;


Or do I need to declare Neo to jndi and then reference it? 
@Resource(name=neo/myGraphDb)
GraphDatabaseService graphDb;


Do I have to update the server.xml file so graphDb knows what to open?  I am
assuming that there is no connection pooling.  I am assuming that my Session
Bean does not need to be a Singleton.

Is an alternative for me to actually open in ejbCreate?
As you stated, it is important to release everything when I'm done ... would
that be done thru ejbRemove?


OK - so now I'll need XA transaction support.  I have never done anything
with XA.  I am trying to look up articles on Google for Glassfish ... so far
I have found very little.  I'm not sure yet if Glassfish has built-in
support for XA (I'm assuming it does) and I can just use the
javax.transaction package, or if I have to do special app server
configuration ... and not yet sure if/how to set it all up as a container
managed transaction.  Can you tell I am not yet comfortable with J2EE?  :-)  

Frankly, I am evaluating the use cases to see if I ever need to share a
transaction with the database or if they are always separate (or if I can
design so they are always separate).  I am essentially using Neo4j as a
hierarchic index against a mysql table ..  lots of queries but very very few
inserts or updates. 




--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3192177.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-22 Thread Alexander Smirnov
No, that's wrong. To create ( and shut down GraphDatabaseService in
your bean, you should:
1) create @Singleton session bean. In its @PostConstruct method,
create appropriate GraphDataBase service object, and stop it in
@PreDestroy method. You can mark that bean as created on startup, if
you wish to get possible database errors on deployment instead of the
first use.
2) create producer method for GraphDataBaseService :
@Produces public GraphDataBaseService getDatabase() { return db; }
3) inject GraphDataBaseService wherever you need it:
@Inject private GraphDataBaseService db;
The most tricky part is Transaction synchronization. There are two options:
- manage transactions in your code by GraphDataBaseService , if you
don't need to synchronize it with other resources.
- create custom TransactionManagerProvider that enforces Neo4j to use
TransactionManager provided by server instead of built-in. You can
grab such code from Spring Data Graph project or my Neo4j connector.
Spring implementation injects TransactionManager from framework, so
you will need at least spring core while my code gets
TransactionManager from JNDI, that works in some servers only. All
other resources participated the same transaction with Neo4j should
also use XA Transactions.

On Fri, Jul 22, 2011 at 12:02 PM, eialbur ronalb...@gmail.com wrote:
 Sorry for the quantity of my questions, and I apologize in advance if any of
 them are trivial or stupid.


 ok - so I guess that in my Session Bean I would use the regular old
 @Resource annotation:
 @Resource
 GraphDatabaseService graphDb;


 Or do I need to declare Neo to jndi and then reference it?
 @Resource(name=neo/myGraphDb)
 GraphDatabaseService graphDb;


 Do I have to update the server.xml file so graphDb knows what to open?  I am
 assuming that there is no connection pooling.  I am assuming that my Session
 Bean does not need to be a Singleton.

 Is an alternative for me to actually open in ejbCreate?
 As you stated, it is important to release everything when I'm done ... would
 that be done thru ejbRemove?


 OK - so now I'll need XA transaction support.  I have never done anything
 with XA.  I am trying to look up articles on Google for Glassfish ... so far
 I have found very little.  I'm not sure yet if Glassfish has built-in
 support for XA (I'm assuming it does) and I can just use the
 javax.transaction package, or if I have to do special app server
 configuration ... and not yet sure if/how to set it all up as a container
 managed transaction.  Can you tell I am not yet comfortable with J2EE?  :-)

 Frankly, I am evaluating the use cases to see if I ever need to share a
 transaction with the database or if they are always separate (or if I can
 design so they are always separate).  I am essentially using Neo4j as a
 hierarchic index against a mysql table ..  lots of queries but very very few
 inserts or updates.




 --
 View this message in context: 
 http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3192177.html
 Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




-- 
_
entia non sunt multiplicanda praeter necessitatem,
(entities should not be multiplied beyond necessity.)
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-21 Thread eialbur
I have two projects.  One is full-on J2EE using Glassfish.  The other is
Servlet based, using Tomcat.

At this point I am not using Spring or Guice - the only injection I get is
the standard J2EE injection for my beans.

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3189874.html
Sent from the Neo4J Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-21 Thread eialbur
BTW - I am willing to document what I learn in a cookbook if there are enough
people with enough patience to hold my hand as I get everything running.  (I
wouldn't want to clog up the mail list with the hand holding - especially if
I summarize it in a cookbook).

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3189880.html
Sent from the Neo4J Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-21 Thread Michael Hunger
We can fork of the discussion to a thread at help.neo4j.org then it stays 
separate.

I would love if you could do that.

Btw. I also meant plain J2EE injection not spring or guice.

Michael

Am 22.07.2011 um 00:34 schrieb eialbur:

 BTW - I am willing to document what I learn in a cookbook if there are enough
 people with enough patience to hold my hand as I get everything running.  (I
 wouldn't want to clog up the mail list with the hand holding - especially if
 I summarize it in a cookbook).
 
 --
 View this message in context: 
 http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3189880.html
 Sent from the Neo4J Community Discussions mailing list archive at Nabble.com.
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-20 Thread eialbur
My understanding of the J2EE standard is that you should *not* do file I/O
from inside a bean (my assumption is to avoid issues if you run in a
clustered environment).  If I access Neo4j directly from a bean, wouldn't I
be violating that?

I am not currently clustered, and my app is small enough I may not need to -
so I am considering violating that standard (because neo4j rocks).  However,
if you provided JCA or other mechanisms so that we could access Neo4j just
like any other J2EE data source, that would make my life simpler.

Barring that, I either need to violate the standard, write my own JCA, or
borrow the JCA developed by one of your other users.

So lets assume I go ahead and access Neo4j from inside my session bean.  Do
you have any Neo4j sanctioned write-up on integrating with a session bean
(or even with a servlet), covering where to connect to the db, where to
close the connection, how to integrate with XA transaction, etc?  I've seen
a couple of threads on these things, but would be more comfortable if Neo4j
had their own cookbook on the subject.

Thanks

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3186416.html
Sent from the Neo4J Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-20 Thread Michael Hunger
To answer a few of your questions:

Neo4j is a database, GraphDatabaseService encapsulates your connection to 
that database.
You don't mind using other databases from J2EE. If you run clustered just use 
Neo4j's High Availability mode across the cluster.

As Neo4j has no concept of a connection but a threadsafe Service that 
represents the database you don't have to start/close a
connection per operation.

It is best to have the Neo4j GraphDatabaseService getting injected into you 
session bean. Make sure that the j2ee lifecycle calls the
shutdown method on shutdown of the j2ee container.

What App server are you running ? Neo4j offers the means of integrating with 
external XA-TX managers - effectively using them instead of
its own TX-manager. 

Good catch with the cookbook. Perhaps we can create one on the wiki and make it 
a part of the manual when we got enough content.

Cheers

Michael

Am 20.07.2011 um 21:31 schrieb eialbur:

 My understanding of the J2EE standard is that you should *not* do file I/O
 from inside a bean (my assumption is to avoid issues if you run in a
 clustered environment).  If I access Neo4j directly from a bean, wouldn't I
 be violating that?
 
 I am not currently clustered, and my app is small enough I may not need to -
 so I am considering violating that standard (because neo4j rocks).  However,
 if you provided JCA or other mechanisms so that we could access Neo4j just
 like any other J2EE data source, that would make my life simpler.
 
 Barring that, I either need to violate the standard, write my own JCA, or
 borrow the JCA developed by one of your other users.
 
 So lets assume I go ahead and access Neo4j from inside my session bean.  Do
 you have any Neo4j sanctioned write-up on integrating with a session bean
 (or even with a servlet), covering where to connect to the db, where to
 close the connection, how to integrate with XA transaction, etc?  I've seen
 a couple of threads on these things, but would be more comfortable if Neo4j
 had their own cookbook on the subject.
 
 Thanks
 
 --
 View this message in context: 
 http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3186416.html
 Sent from the Neo4J Community Discussions mailing list archive at Nabble.com.
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-18 Thread Alexander Smirnov
I use neo4j in Glassfish, with JCA connector (
https://github.com/alexsmirnov/neo4j-connector ), and currently tested
it with Jboss7.
The connector has been created for my startup project (
www.netoprise.com, sorry for horrible design, ot's only 10% done ),
and I plan to convert it to HA connector before launch.
Unfortunately, Neo4j uses two XA resources and wasn't designed for
connector, that makes integration with JCA pretty hard.
Seems that neotechnology guys decided to use Spring only :-)
P.S. There are some mentions about binary network protocol suitable
for JCA, but I don't see any code related to it in repo. I would help
in development, if neo team doesn't have enough resources to implement
it soon.

On Sun, Jul 17, 2011 at 8:03 AM, eialbur ronalb...@gmail.com wrote:
 I really like Neo, but am concerned that there is so little official company
 support for J2EE.  I want to use Neo as a standard data source in J2EE, with
 container managed transactions, etc.

 I don't want to use the REST interface - I want a standard data source
 interface.  There does not appear to be an officially provided mechanism to
 use Neo as a data source in J2EE.  I've seen a couple of people post their
 code to help someone get started, but shouldn't Neo provide a real official
 sanctioned mechanism?

 P.S.  I don't want this thread to turn into a religious war over REST.  If
 you like REST and want to defend it then please start a thread for that
 purpose.  Please just accept that I don't want to use the REST interface - I
 want a standard DB interface for my DB.

 --
 View this message in context: 
 http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3176938.html
 Sent from the Neo4J Community Discussions mailing list archive at Nabble.com.
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




-- 
_
entia non sunt multiplicanda praeter necessitatem,
(entities should not be multiplied beyond necessity.)
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Officially supported mechanism for J2EE

2011-07-17 Thread eialbur
I really like Neo, but am concerned that there is so little official company
support for J2EE.  I want to use Neo as a standard data source in J2EE, with
container managed transactions, etc.

I don't want to use the REST interface - I want a standard data source
interface.  There does not appear to be an officially provided mechanism to
use Neo as a data source in J2EE.  I've seen a couple of people post their
code to help someone get started, but shouldn't Neo provide a real official
sanctioned mechanism?

P.S.  I don't want this thread to turn into a religious war over REST.  If
you like REST and want to defend it then please start a thread for that
purpose.  Please just accept that I don't want to use the REST interface - I
want a standard DB interface for my DB.

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3176938.html
Sent from the Neo4J Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Officially supported mechanism for J2EE

2011-07-17 Thread Michael Hunger
Hi,

do you mean a javax.sql.DataSource or an JCA adaptor ? 

Could you please explain your architecture and usage scenario where this would 
be necessary.

You can use Neo4j in embedded mode inside any J2EE container without issues. If 
the container
comes with its own XA-TM then you can integrate with that.

Cheers

Michael

Am 17.07.2011 um 17:03 schrieb eialbur:

 I really like Neo, but am concerned that there is so little official company
 support for J2EE.  I want to use Neo as a standard data source in J2EE, with
 container managed transactions, etc.
 
 I don't want to use the REST interface - I want a standard data source
 interface.  There does not appear to be an officially provided mechanism to
 use Neo as a data source in J2EE.  I've seen a couple of people post their
 code to help someone get started, but shouldn't Neo provide a real official
 sanctioned mechanism?
 
 P.S.  I don't want this thread to turn into a religious war over REST.  If
 you like REST and want to defend it then please start a thread for that
 purpose.  Please just accept that I don't want to use the REST interface - I
 want a standard DB interface for my DB.
 
 --
 View this message in context: 
 http://neo4j-community-discussions.438527.n3.nabble.com/Officially-supported-mechanism-for-J2EE-tp3176938p3176938.html
 Sent from the Neo4J Community Discussions mailing list archive at Nabble.com.
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user