Is it possible to write a hibernate dialect for Apache Phoenix? - apache

i would like to write an hibernate dialect for Apache Phoenix. The huge problem is that the keyword of an insert statement is "Upsert" instead of "Insert". This keyword is declared at org.hibernate.sql.Insert. Is there a possibility to write an dialect for Apache Phoenix ?
Source http://phoenix.apache.org/language/index.html#upsert_values
Kind regards

I found a theoretical solution. The easiest way is to override the jdbc created by apache phoenix. You have to override exceuteQuery() and updateQuery() functions.There you have to replace "insert" and "update" with "upsert".
What do you think? I didn't test it yet.

this seems to work pretty well if you are ok with using the "fat" phoenix client: https://github.com/jruesga/phoenix-hibernate-dialect

Related

Equivalent of MySQL's `show processlist` in SparkSQL

Is there an equivalent of MySQL's command show processlist; in Apache SparkSQL?
I am providing the answer myself here (got some tip from my colleagues).
There may be no direct equivalent commands in SparkSQL, but one can use the WebUI for Spark to achieve similar effects.
c.f. Monitoring and Instrumentation (Official Doc of Apache Spark)

How is Groovy hot-swap agent "gragent.jar" is supposed to work in Intellij Idea?

It seems doesn't add anything to the regular java hot-swapping. I'd like to get the groovy class hot-swapped in a case of method adding/removing/signature changing. Is it possible with this agent?
Dany's answer is correct, but doesn't answer the question fully. No, this agent doesn't help you to hot-swap when fields or methods are changed. You might want to consider using DCEVM for that.
Removes all timestamp-related Groovy fields on class loading
Also clears Groovy's call site cache
As stated in
https://github.com/JetBrains/intellij-community/blob/master/plugins/groovy/hotswap/agentSrc/org/groovy/debug/hotswap/ResetAgent.java

idea SQL dialect is not configured in mybatis

SQL dialect is not configured
this is mine mapper.xml,i want to clear Warning
Anytime you get the light bulb, if you hit AltEnter / ⌥↵ you will most often get a list of quick-fixes (or intentions). In this case you will should get an option to inject the language, or to edit the language injection settings. It's not clear what type of file you are editing in your screenshot (it's obviously some type of XML like markup). So I'm not 100% sure which quick fix (if any) will be available in that context.
You can also take a look at this SO answer -- https://stackoverflow.com/a/30759243/1348743 -- of mine as it provides a lot more detail about other ways of configuring SQL dialects. Also look at the IntelliJ IDEA help documentation on Using Language Injections.
idea -> setting -> SQL dialect
sql dialect
see the right column 'sql dialect',default value is 'Generic'.
change it to your own db name

What is the NHibernate Mapping.ByCode equivalent of the "hbm2ddl.keywords" setting?

I just ran into a situation related to this SO question: How to tell NHibernate always to force quoted identifiers?
My entity has an "Order" property, and NH chokes trying to create the database. I am using the new Mapping.ByCode feature of NHibernate 3.2, and its not entirely clear where I need to apply the hbm2dll.keywords setting.
Thanks in advance!
Ah, found it: http://nhforge.org/blogs/nhibernate/archive/2009/06/24/auto-quote-table-column-names.aspx
When you have an instance of a configured configuration (just before call BuildSessionFactory) you can execute:
SchemaMetadataUpdater.QuoteTableAndColumns(configuration);

Oracle: Is there a way to encode a value using the unix crypt method?

Is there a way to encode a value using the unix crypt method in oracle 10g?
(Other DBMS like MySQL support this)
The DBMS_CRYPTO PL/SQL package has encryption, but none using the native weakness of the Unix crypt(1). It's much more analogous to crypt(3).
If you need the exact crypt(1) implementation, you're going to have to code it yourself. Here's the C code for it.
Provided you are one Oracle8i or higher this is possible.
The solution is to write a Java Stored Procedure which can execute OS commands, and use that to run Unix crypt. Tim Hall's Oracle-Base site has an example of how to code one of these things. Find it here.