eclipselink without persistence.xml - eclipselink

I'm not a big fan of XML files. Therefore I'm wondering if there is a way to use eclipselink without its persistence.xml configuration file. Why?
Because I want to manage different databases dynamically. It would be much easier to do it without the XML file.
I'm surprised that I couldn't find anything on the web for now.

Not really, but you could create an EclipseLink ServerSession directly and wrap it with an EntityManagerFactoryImpl, but I would not suggest it.
You would be better off creating a persistence.xml. You can still do dynamic databases, you just need to pass a properties file to createEntityManagerFactory(Map) that include your database info.

Though it is not an direct answer to your question, this will help for the second part of your question. For managin multiple database connections, you can define multiple server sessions in sessions.xml and access those where you want.
you may use follwoing lines for accessing particular session
ServerSession aSession = = (ServerSession) SessionManager.getManager().getSession("session_2");

Related

Exclude versioned documents while Querying-Raven db

I have appended the versioning bundle in midway of my project after having written most of my raven queries in my data access layer. Now because of versioning i have lots of replicated data. Whenever i query a type of document i can see the values replicated as many times as the document is versioned. Is there way to stop querying the re-visioned documents when i query for the current data in common without re-writing all of my queries with Exclude("Revisions").Is there any setting where i can say query on re-visioned document =False which i can set globally? please suggest something to overcome this..
That is the way it works, actually. It appears that you have disabled the versionning bundle, which would cause this to happen.

Is it possible to store and retrieve objects created using Objective-C? (in a database, for use in iOS app)

I'm working on an iOS app that creates "location sets" where each row contains a location name and a GeoPoint, and each set has its own name. Each of these sets are stored in an object inside our program (all belonging to the same class). Now we want to give users the capability to create sets and upload them to a database, allowing other users to access and download them to their device.
I've been looking in to back-end solutions for work like this, but pretty much everything I've found so far focuses on relational databases and adding and deleting rows and using SQL-like language to retrieve them. Is there a way to store these objects just as objects (and not unpack the info inside to tables), and then retrieve them? It feels like that would be a much simpler way of going about this.
I'm an absolute beginner when it comes to databases, so forgive me if there's info missing here that you would need to help me out. I'll make sure to keep checking back in case someone asks for more info.
Thanks!
Coredata might be useful for you as its based upon the entity. So you can play multiple things around it by using queries (predicates).
But if you just want to save and retrieve back, then as a simplest solution I would suggest to create array/dictionary with entity data, save that into NSUserDefaults so you can retrieve back same while re-launching the app.
Webservices for iOS development:
raywenderlich
icodeblog
WSDL Webservices
Response data parsing, it would be either JSON or XML:
JSON Parsing
XML Parsing
Hope these links would be helpful for you.
I ended up using Parse's mobile back-end service. That was the type of service I was looking for. I've found other similar services since then, like Applilcasa and StackMob, but we're pretty happy with Parse so far.

How to handle multiple data sources in one WCF Domain Service?

I'm working on creating a WCF Domain Service which at the moment provides access to a database. I created the Entity Model, added the DomainService (LinqToEntitiesDomainService) and everything works so far.
But there are cases when my data doesn't come from the DB but somewhere else (for instance an uploaded file). Are there any best practices out there how to handle this different data sources properly without resorting to writing two completely different data providers? It would be great to access both types with one interface. Is there already something I can use?
I'm fairly new to this so any advice apart from that is highly appreciated.
How many cases where the data comes from a file? How many files? How will you know if a file is there? Are you going to poll the directory? what format are the files? (XML support is possible)
Microsoft's documentation suggests that you can create a custom host endpoint, but I don't know what limitations there are.

Thread: How to deploy a Pentaho report with subreports across multiple environments

I'm trying to create reports that I could deploy in different environments (test, production) and/or with different databases, without changing the prpt file.
So, I created some jndis, and pased the jndi name as a parameter to a xaction that in turn executed the query and passed the result to the prpt. It worked great.
Until I started using subreports.
I think there's no way to pass a result set to a subreport for each line of the main report.
It seems that If you use subreports, you have to define the  connection and the query inside the subreport.
Am I wrong? Has anyone tried this? What's the "proper" way to deploy a multi-tenant report with subreports, and pass the connection or jndi as a parameter?
(I'm open to drop the use of jndi if there's another way)
Thanks!
Update: There's a bug related to this in biserver 3.7 & 3.8 link
nope, the connection can be defined in the parent report. just make sure you specify it in the Query name setting of the subreport itself.
XActions precompute all datasets before the reporting engine has a chance to actually work with them. External datasets are precomputed without any information on your subreports, and therefore it will fail (unless you use several ugly tricks to use a calculated query-name as a lookup-key into the precomputed table-models).
Why don't you use JNDI, like everyone else? JDNI was designed to abstract connection information into a logical name. The connection is defined outside of the report, and the report just references the name.
Read more on my blog post named: "Dont hardcode host names, use JDNI" (which probably describes the core of your problem ;) ).

NHibernate using single configuration file to connect to multiple dbs

I'd like to have a single configuration file and then when I'm creating a session change the hibernate-configuration->session-factory->connection.connection_string property to what I want it to be programmatically? Is it possible?
UPDATE:
I believe I may be able to do this like this
Configuration cfg = new Configuration();
cfg.Configure(sessionFactoryConfigPath);
cfg.Properties["connection.connection_string"] = ...
What I would wonder than, if that is ok, Is this a bad way to handle connecting to a different database for each session? if so why etc. I'd also like to know if/how you can open an nhibernate session with a .net connection object?
Use the ISessionFactory.OpenSession() overload that takes a IDbConnection.
That's how Castle's DifferentDatabaseScope does it.
I think it is better to use different configuration files per each data base just becouse you will be able to switch dialects very esasy.
You may also see this answer as it allows full configuration of session factories through one file. Configure NHibernate hibernate.cfg.xml file to have more connection strings