Passing a Map/HashMap from Mybatis mapper to SQL procedure - database

I want to Pass 'Map' to an PL/SQL Stored Procedure via Spring Mybatis Mapper XML.
Is there any way i can pass it via using appropriate java type and jdbctype.I can use a Java class to map to appropriate TypeHandler, but is there any other way we can do this without using a type handler.

You have to use a TypeHandler. That's how MyBatis sets Java types set into Prepared and Callable Statements.
If you register the TypeHandler with your MyBatis configuration, then MyBatis will choose the correct type handler automatically, avoiding typing "typeHandler=..." in the sql map. That's how you can get it to use javaType variable to find your type handler.
i.e. (org.apache.ibatis.session.Configuration)
configuration.getTypeHandlerRegistry().register(HashMap.class, new MyPLSQLTypeHandler());

Related

Flink 1.8.2 state evolution throwing exception

I am trying to alter a case class which has around 240 variable among which some are other pojos which are defined by me
Example : Signal (case class) has variable PowerPojoFeature, UserFeature.
When I alter any of the pojo add new variables it throws below exception
rg.apache.flink.util.StateMigrationException: The new state typeSerializer for operator state must not be incompatible.
at org.apache.flink.runtime.state.DefaultOperatorStateBackend.getListState(DefaultOperatorStateBackend.java:323)
Is there any example I can write custom serialisation for this or any other solution
Flink's serializer doesn't yet support case class evolution. You need to either use POJOs or Avro, or implement a custom serializer.
There are snippets of examples in the documentation for custom serializers.
Another approach would be to use the State Processor API to migrate the state and data type.

microsoft flow null required parameter

I'm trying to create a custom connector in MS Flow but one of the required parameters is always null. I don't know why that's just how this web api is...
"&scope&catid=MFR"
I need to have the "scope" query parameter required show it shows up in the request but I need it to be a null value? How do I do that?
I am not sure what you are connecting to, but different systems will interpret your parameters differently depending on what they expect. You could try "&scope=&catid=MFR" or if you can URL Encode it, try "%26scope%3D%00%26catid%3DMFR" which explicitly passes a Null.

How to call a method with parameters in Apache Camel using Java DSL

How to call a method in Camel Route using Java DSL? I want to get a compile time error in Eclipse if I am using the wrong signature for method.
.bean(Foo.class, "setDetails("1", "Camel")")
Here I won't get compile time error for the wrong method signature as method was defined in string.
This is, as far as I know, not possible because Camel calls the method through reflection API.
What you can do, is to create constants in Foo.class with the method names and then use the constants in the bean calls instead of the hard-coded method name Strings.
But even then, you are of course able to rename a method in the bean without adapting the constant. The functionality would be broken but the compiler would be still happy.
If the bean is dedicated to Camel routes and under your control, the best you can do is to refactor the bean.
Remove the method parameters, set them on the message exchange and inject them with #Header, #Property
Split the bean into very small beans with only one method to get rid of the method names
Try this
.bean(Foo.class, "setDetails(1, 'Camel')")
If your first parameter is of type int just put the number without quotes
Second parameter is String, so you should put String to single quotes.
According to the docs, from camel 2.9 onwards, you can do pass in an integer and a string as parameters in a method call (using your example) like this:
.bean(Foo.class, "setDetails(1, 'camel')")
OR
.to("bean:Foo?method=setDetails(1, 'camel')")
If I understand the question correctly, you want a compile-time error about something that is evaluated at runtime. This is simply not possible.

Pass parameter to constructor - NativeLookup.create

How can I pass parameter to constructor of Native code in Codename one?
I could only see NativeLookup.create method which takes no parameter. The requirement is to create native object based on parameter (like port number or url).
NativeCode nativeCode = (NativeCode) NativeLookup.create(NativeCode.class);
It would be even great if there is any way to get instance from a factory method which takes parameter. Thanks in advance.
You can't and you don't need to!
The native interface is a simple interface. If you have an object that needs a constructor argument just create it within the native object methods. Keep in mind that passing an argument to a constructor might work well for Android but when you want to do the same thing in iOS's Objective-C etc. this might not make sense.

Differences between createObject and createManagedObject

I'm using HtmlPage.RegisterCreateableType method to call some C# code from javascript. In MSDN documentation they say:
Registers a managed type as available for creation from JavaScript
code, through the Content.services.createObject and
Content.services.createManagedObject helper methods
There isn't more explanation about these two methods and I don't know what are the differences. Anybody knows differences between these methods?
Tons of information on both of these methods here.
createObject
Description: Given a registered scriptAlias, this method returns a
script wrapper for the corresponding managed type.
createManagedObject
Description: Given the typeName of the target .NET Framework type,
this method creates a default instance of the type by using either a
parameterless constructor (for reference types) or the default value
representation (for value types).
Basically, you use createObject if you have a script alias to an object. If you just need to create an instance of a type of object you use createManagedObject.

Resources