Deploying Datanucleus on jboss AS 7 - jdo

I need to deploy datanucleus using JCA. My application is built on ejb3 and CDI.
I am not able to proceed after this error.
21:29:38,789 SEVERE [DataNucleus.Datastore.Schema] (http--10.91.10.49-8080-1) Failed initialising database.: org.datanucleus.exceptions.
NucleusDataStoreException: You cannot commit during a managed transaction!
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.close(ConnectionFactoryImpl.java:522) [datanucleus-rdbms-3.0.0-m6.jar:]
I am using LocalTransaction with the datasource managed by Jboss
I have defined
standalone.xml
driver-class oracle.jdbc.driver.OracleDriver
ra.xml
transaction-support LocalTransaction
jdopersistance.xml
datanucleus.jtaLocator custom_jndi
datanucleus.jtaJndiLocation java:jboss/TransactionManager
datanucleus.connection.resourceType JTA
The resource-adapter defined in standalone.xml is properly binding and I am able to access it inside an ejb.
The above exception occurs when I try to access the persistence manager.
Question : Did anyone got managed transactions with managed datasource under JCA working for datnucleus on Jboss as 7
Any clues on Why is datanucleus trying to commit even after I defined datanucleus.connection.resourceType = JTA
Other info
jdbc driver ojdbc6.jar
datanucleus -datanucleus-jca-3.0.0-m6.rar
Jboss as 7 final
jdk 1.6
Ubuntu 8.10
Oracle 11g
Answer
Thanks andy it works after I created two separate datasources 1) with JTA 2) without JTA. datanucleus.ConnectionFactory2Name ==> points to non-JTA. Addtionally i had to add datanucleus.jtaJndiLocation = java:jboss/TransactionManager. Seems like this is specific to oracle, I am yet to try with other databases. Discussion at www.datanucleus.org/servlet/forum/viewthread_thread,4663_offset helped.

Thanks andy it works after I created two separate datasources 1) with JTA 2) without JTA. datanucleus.ConnectionFactory2Name ==> points to non-JTA. Addtionally i had to add datanucleus.jtaJndiLocation = java:jboss/TransactionManager. Seems like this is specific to oracle, I am yet to try with other databases. Discussion at datanucleus.org/servlet/forum/viewthread_thread,4663_offset helped

Related

Use Symfony 4.4.23 without a Database, Symfony update is causing issues with this

I have an old Symfony website which is using the framework bundle but no database is required for the content. This works fine till 4.4.18 but upgrading to the latest version is giving the following error:
An exception occurred in driver: could not find driver
I haven't modified DATABASE_URL in .env or configured the driver in config/packages/doctrine.yaml. Is there anyway I can simple disable the use of database?
Thanks to the comment from #cerad, removing doctrine-migrations package from composer.json helped with the issue.
As I am not using a Database for the site, this is fine for me.
if your app doesn't use the database the best course of action is to remove the doctrine/doctrine-bundle and/or symfony/orm-pack (if you've installed the orm support via pack)
if that's not an option than set the DATABASE_URL= to nothing (like that, not the empty string), or if you've hit some bug in dbal dsn parsing give it the dummy sqlite until the issue gets resolved DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"

EntityFramework 7 - CodeFirst - SQLite - Manage DB using ApplyMigrations at runtime

I am well on my way to utilizing EF7 CodeFirst with SQLite...but really want to employ DB Migrations at runtime. This is a desktop application (Click-once deployment) meant to sync with a main database when connection is available, and provide offline data when no connection is present.
I have pulled down the nuget pre-release versions and all is working, except I cannot find any documentation of how to apply the migrations at runtime. I can successfully Add-Migrations and manually Apply-Migrations...but need a way to programatically Apply-Migrations at runtime.
I've also browsed the EF7 open-source project, but could not get anywhere there.
Versions I'm using: Latest Pre-release as of 9/15/2015
EntityFramework.Sqlite v7.0.0-beta7
EntityFramework.Relational v7.0.0-beta7
EntityFramework.Commands v7.0.0-beta7
...et al...you get the picture.
I am asking for help to apply runtime migrations...or what is the documented/recommended path for programatically maintaining a local/embedded db using EF7 CodeFirst SQLite?
UPDATE:
I went back to EF6 with SQLite but then found out that there is not SQLMigrationGenerator for SQLite.
EDIT:
I believe ApplyMigrations() method referenced in one of the notes has been deprecated. Searching the repository, there is no reference to "ApplyMigrations".
Today you can invoke the extension method Migrate on the DatabaseFacade.
This method is only available when the using Microsoft.Data.Entity statement is present. It comes from the RelationalDatabaseFacadeExtensions class that is part of the EntityFramework.Relational package.
Still have to find out how to migrate up and down from the API.

Propel migration with multiple connections defined

Is there any chance I can migrate only one database, if I have define multiple connections in my config.yml
If I run
propel:migration:diff --connection=a it still want to generate migration for all databases defined.
My vendors
propel/propel-bundle 1.2.7 Integration of Propel in Symfony2
propel/propel1 1.6.9 Propel is an open-source Object-Relational Mapping (ORM) for PHP5.
Yes, you can. Although I have Propel 1.7.1 I don't think this has changed since 1.6.9.
You have to create a separate buildtime-conf.xml file for each connection and then pass the path to this file while calling propel-gen diff. So, let's say you have a-buildtime-conf.xml:
propel-gen . diff -Dpropel.buildtime.conf.file=a-buildtime-conf.xml
I found this by debugging the GeneratorConfig::getBuildConnections() method.

Setting up SubSonic with Databases other than SQL Server

I am currently using SubSonic (2.2 and 3) for some ASP.NET projects and have managed to get them working with SQL Server (using ActiveRecord). However, I also want to know how to set it up with other (open source) databases, e.g. PostgreSQL and SQLite. This is so I can use it on a web host without SQL Server on. The providers I have found are:
PostgreSQL: Npgsql
SQLite: System.Data.SQLite or Mono.Data.SqliteClient (if it works with Microsoft.NET)
Anyone have any experience with SubSonic know how to do this (some sample demo would be good - just a basic primer on querying would be fine)? Non-ASP.NET MVC though (not got into it yet). I have only basic knowledge of SQLite (basically using SQLite Manager in Firefox and querying it via PHP Data Objects) and have not used Postgresql, but assume it would be more scalable than SQLite.
For version 3
PostgreSQL: There aren't any templates for postgres at the moment so you'd need to create the templates yourself
SQLite - The steps should be as follows:
Add a reference to System.Data.SQLite
Look in the TemplateProviders folder you'll find a SQLite.ttinclude which you'll need to drop into your project instead of SQLServer.ttinclude.
Change the .tt files that reference SQLServer.ttinclude to reference SQLite.ttinclude instead.
This is so I can use it on a web host without SQL Server on.
With the release of SQLExpress dont all hosts offer this? (I only use dedicated server so I have no direct experiance with this)
In response to your question.
SQLite - http://codefornothing.wordpress.com/2007/07/19/sqlite-data-provider-for-subsonic-part-2/
Postgre: Doesnt look as simple,
Subsonic postgreSQL Template
PostgreSQL via subsonic
Good luck.
In short, Subsonic only support few database only NOT ALL ( that what their claimed :( ). Try nHibernate, support most of the database.

Active Record and Linq T4 Templates problem

I've started a C# web application project using subsonic 3.0.3 as my DAL and SQLite for database.
It doesn't have any problem when using SimpleRepo, but the problem occurs when I try to use ActiveRecord/Linq T4 templates.
It says "Metadata file 'System.Data.SQLite' could not be found". The settings.ttinclude is the one provided with SQLite.ttinclude file and its config looks ok, and other files are instructed to use SQLite.ttinclude of course. I've also tested them with an SQL Server database and everything goes fine.
Also tried searching about it on the net and all I could find were these:
Subsonic Google Groups which instructs me to add a reference to System.Data.SQLite to the top of settings.ttinclude. No luck.
Someone at here commented about this issue, and it was answered to check the connection string, which doesn't seem to be my problem, because the app works when I use SimpleRepo.
Is SQLite installed on your machine? You need the .NET driver for it as well (that's what can't be found).

Resources