Castle Active Record NHibernate Sql Server Ce 3.5 (SqlServerCe) Problem Updating Schema - nhibernate

I am trying to Update Schema on SQL Server CE 3.5 using Active Record by Castle. I have encountered an error - exception on the bottom.
I believe it is not a new issue, but I could not find a walk around for this issue. When trying to Update Schema using Active Record I get an exception. It seems that there is a wrong GetSchema call. It should be System.Data.SqlServerCe.SqlCeConnection.GetSchema() instead of DbConnection.GetSchema(). I got this information from here.
I am looking for resolution, not just information that it is MS problem. It is my problem right now, and possibly other people as well.
Exception:
System.NotSupportedException: The method is not supported.
in System.Data.Common.DbConnection.GetSchema(String collectionName, String[] restrictionValues)
in NHibernate.Dialect.Schema.AbstractDataBaseSchema.GetTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
in NHibernate.Tool.hbm2ddl.DatabaseMetadata.GetTableMetadata(String name, String schema, String catalog, Boolean isQuoted)
in NHibernate.Cfg.Configuration.GenerateSchemaUpdateScript(Dialect dialect, DatabaseMetadata databaseMetadata)
in NHibernate.Tool.hbm2ddl.SchemaUpdate.Execute(Action`1 scriptAction, Boolean doUpdate)

SQL Server CE 4.0 implements GetSchema(). If you can't upgrade I guess you're SOL...

Related

ignite query cache with value as list of objects

I am using ignite cache with key as String and value as Collection of objects (similar type) say List.
Now i would like to query on the students stored in cache let's say 5 top scored students.
defined the configuration as below
CacheConfiguration<String, List<Student>> cfg = new CacheConfiguration<String, List<Student>>("students");
ignite = Ignition.start("/usr/localc/ignite/examples/config/example-ignite.xml");
cfg.setIndexedTypes(String.class, List.class);
Now I fired a query like
SqlFieldsQuery qry = new SqlFieldsQuery("select count(*) from Person");
Then got exception like
Exception in thread "main" java.lang.AbstractMethodError: org.apache.ignite.internal.processors.query.h2.opt.GridH2Table$ScanIndex.getCost(Lorg/h2/engine/Session;[I[Lorg/h2/table/TableFilter;ILorg/h2/result/SortOrder;Ljava/util/HashSet;)D
at org.h2.table.TableFilter.getBestPlanItem(TableFilter.java:203)
at org.h2.table.Plan.calculateCost(Plan.java:123)
at org.h2.command.dml.Optimizer.testPlan(Optimizer.java:183)
at org.h2.command.dml.Optimizer.calculateBestPlan(Optimizer.java:79)
at org.h2.command.dml.Optimizer.optimize(Optimizer.java:242)
at org.h2.command.dml.Select.preparePlan(Select.java:1014)
at org.h2.command.dml.Select.prepare(Select.java:878)
at org.h2.command.Parser.prepareCommand(Parser.java:259)
at org.h2.engine.Session.prepareLocal(Session.java:560)
at org.h2.engine.Session.prepareCommand(Session.java:501)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1202)
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:290)
at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:406)
at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1121)
at org.apache.ignite.internal.processors.query.GridQueryProcessor$2.applyx(GridQueryProcessor.java:732)
at org.apache.ignite.internal.processors.query.GridQueryProcessor$2.applyx(GridQueryProcessor.java:730)
at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:1666)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.queryTwoStep(GridQueryProcessor.java:730)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:700)
at com.tcs.enm.processor.Main.main(Main.java:47)
Can any one help me how to query ???
To execute such query you should store each Student as a separate entry. Student class should have all the annotations defining fields and indexes and the cache configuration should look like this:
cfg.setIndexedTypes(String.class, Student.class);
For more details refer to this documentation: https://apacheignite.readme.io/docs/sql-queries
For anyone in the future who has this issue, this error message is likely due to using an incorrect version of H2.
http://apache-ignite-users.70518.x6.nabble.com/Exception-while-trying-to-access-cache-via-JDBC-API-td8648.html#a8651
If you're using Ignite 1.7, you need h2database 1.4.191.
Note that h2database 1.4.192 WILL give you the exception in the question because there are some changes in 192 which Ignite wasn't made to handle
I went through my packages and changed the H2 version to 1.4.191 and it fixed my problems.

play.exceptions.JavaExecutionException: org.hibernate.MappingException: No Dialect mapping for JDBC type

I have a play framework application [version 1.2.7].
when I try to get data in a non-jpa Entity form I get this exception
play.exceptions.JavaExecutionException: org.hibernate.MappingException: No Dialect mapping for JDBC type: 16
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
at Invocation.HTTP Request(Play!)
Caused by: javax.persistence.PersistenceException: org.hibernate.MappingException: No Dialect mapping for JDBC type: 16
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1389)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1317)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:255)
my code is as follows
List lst = JPA.em().createNativeQuery(myQuery)
.setParameter("p", searchPhrase)
.getResultList();
I want to use native query and get all extract all data but I dont want to be limited to getting it as an Jpa Entity.
any help will be appreciated.
If I'm not wrong the JDBC type 16 is BOOLEAN (look atjava.sql.Types). Your problem might be caused by use of wrong hibernate.dialect which doesn't know BOOLEAN types which occur in one of tables you are trying to select. Check hibernate.dialect property in your persistence.xml or hibernate.cfg.xml.

updateblob fails in Powerbuilder

In Powerbuilder I am trying to update a table (Oracle) with blob but get sqlerror, "Database statement must refer to blob variable". My declaration and updateblob statements are as follows:
blob lblob_newxml
long llong_subid
UPDATEBLOB RP_XML_FORMS SET XML_DOC = :lblob_newxml
WHERE SUBMISSION_ID = :llong_subid
USING SQLCA;
Does anybody know why it is happening and or how to solve this problem? Thanks.
To get more information on this problem and the possible causes, I'd run with one of the database traces turned on. (You can check out database trace options in the Connecting to Your Database manual; link may not be appropriate for your PB version, which you haven't mentioned yet.) This may or may not tell you more, but it tracks everything between the app and when the PB drivers pass the commands "over the wall" to the database's driver.
Good luck,
Terry.
"The PowerBuilder VM can get the SQL syntax for the following types of errors, and passes it to the Transaction object’s DBError event for the following types of errors: ..." (see this page).
If your lblob_newxml is null then use this update statement instead:
UPDATE RP_XML_FORMS SET XML_DOC = NULL
WHERE SUBMISSION_ID = :llong_subid
USING SQLCA;

Firebird Error: "operating system directive CreateFile failed"

Did any one see this error ??
I'm using Firebird 2.1 and database create statement is getting failed on v.first stored procedure execution.
Error Message:
[869] : There was a problem creating a DBProvider with the following parameters: StoredProcedureName:sel_NextObjectID
2. operating system directive CreateFile failed
3. operating system directive CreateFile failed
Stack Trace
2.at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.Create()
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckOut()
at FirebirdSql.Data.FirebirdClient.FbConnection.Open()
at FirebirdDBProvider.NewProvider_Internal(String commandText, String connectionString, CommandType commandType)
3 at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.Create()
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckOut()
at FirebirdSql.Data.FirebirdClient.FbConnection.Open()
at FirebirdDBProvider.NewProvider_Internal(String commandText, String connectionString, CommandType commandType)
You can get this error when you are attempting to connect to a database which does not yet exist.
It is not entirely clear from your post what you mean with 'database create statement is getting failed on v.first stored procedure execution', but I assume you are attempting to create a database and then execute DDL.
To connect to a database, you first need to create it. To create a database you need to use createDatabase first.
Well, deleting all temp file fixed this thing. Found the same issue on firebird too.
1) Make sure your application (on which you're facing this issue) is not running.
2) One Run dialog (Window + R) and type in “%temp%” and click “ok”
3) In the opened folder delete all the files (which can be deleted).
4) Start the application.
Just had same issue, the reason was no free space available on the system drive.

Hangs with LINQ-SQL Server and TransactionScope

I'm encountering a hang when the program tries to access the fruit database. I've already enabled network access MSDTC on both my development computer and the SQL Server server.
Code:
(pardon the code coloring...SO's misinterpreting my VB .NET)
Using ts As New TransactionScope
Dim fruit As New FruitDataContext
Dim thingies As New ThingiesDataContext
If (From f In fruit.tblApples Where f.Rotten = "Yes" AndAlso f.batch = 1).Count >= 1 Then
'Record today's date as the day that the rotten apples were dumped.
End If
'Other complicated code that uses ThingiesDataContext and FruitDataContext
du.SubmitChanges()
ts.Complete()
End Using
Edit:
I've dug around a bit more and it turns out that the problem lies in the line of LINQ. When I tried to view it with the LINQ to SQL Visualizer, I get the following error:
System.InvalidCastException: Specified cast is not valid.
at LinqToSqlQueryVisualizer.SqlQueryInfo.deserialize(Stream stream)
at LinqToSqlQueryVisualizer.Visualizer.Display(IDialogVisualizerService windowService, Stream rawStream)
at LinqToSqlQueryVisualizer.DialogChooser.Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.CreateViewer(IntPtr hwnd, HostServicesHelper hsh, SafeProxyWrapper proxy)
I've also edited the LINQ statement to be closer to my real code.
Final edit:
I tried using a normal SqlConnection instead of a "thingies as New ThingiesDataContext" and the problem still occurs.
It appears that TransactionScope cannot handle multiple SQL connections inside the same transaction.
Official Microsoft Note
parallel transactions are not supported by SQL Server.
From MSDN: http://msdn.microsoft.com/en-us/library/bb896149.aspx
This is not an MSDTC issue. If it were, you would get an error saying DTC is not enabled and needs to be. It's also not a deadlock issue, because you would get a specific error about that as well.
If I had to guess, I would say that the 'Other complicated code...' is attempting to perform a database operation and is being blocked by one or the other database context objects.
One way you can determine this is to run SQL Profiler to see what SQL statements are actually being executed on the server, and check for blocks.