i am new in playframework i know how to install playframework and connect it to the database . Is there is any tutorial for that like how to perform sql operation using java in playframework.
SQL is not dependent on the Play Framework; it's dependent on the database you choose to use as a store for your Play Framework application.
W3 Schools has a pretty good tutorial for basic SQL operations. You can also look up additional commands and functionality provided by your specific database provider in the docs for that database. e.g. look here if you've chosen to use a version of PostgreSQL
The problem is confused slightly in that what I think you need is a method for your application to map rich application objects to flat database tables. This task can be done using an Object-Relationship-Mapping or functional-mapping tool. Ebean is an example of an ORM and Slick is an example of a functional mapping tool, both of which can be used in Play applications by adding their drivers to your /project/build.scala file in the list of your project dependencies.
Setting up Ebean for your Java-based Play project is covered on the page of the Play 2.1 Java tutorial after the one linked to by bistros - Using the Ebean ORM
see playframework.com tutorial page.
http://www.playframework.com/documentation/2.1.x/Installing
http://www.playframework.com/documentation/2.1.x/JavaDatabase
You can start direct with examples from the website. I think this one is very nice to understand how to work with database.
play-java-ebean-example
Related
I want to start with ETL on java. I am using Intellij. I wanted to know how the integration can be done or which tool is compatible with intellij.
Also if there is any tutorials on the basics of ETL with java.
Exactly what and all I will need if I want to do the transformation of data
It can be basic like just taking in random input from a file and transforming
the data based on particular logic
Creating code to extract (query different sources like DB, XML, web service, etc) to transform (you know make everything compatible, removing dup's, creating Dims and Facts) to load them to targets (databases and more)...
All this is not new. Java is great but creating ETLs with it is creating a non-standar app... And is going to become a legacy and then you need to build a scheduler to run the loads and to integrate with several components.
So. I strongly recommend instead of create a Java app, take a look to products like Informatica PowerCenter and/or Oracle Data Integrator.
This solutions are business wide standard for ETL worldwide, provides objects and methods to avoid apps that needs to be hardly mantein and are on top of any applications... Also are used for integration, migration, B2B, BI... Named...
Good luck!
You would be re- inventing the wheel if you are trying to create a Java based etl product .
Talend is a java based open source ETL tool which gives the features of an ETL tool and lets one write Java code to integrate ..
Pentaho is another Java based ETL tool..
Both of them are popular and have good UI...
I am working on Calendar-Project in Codename one and I want to store my events in a database so I just want to ask that can I use Realm to store my event data. Can Codename one support Realm framework?, And if it is not, then there is any other option which replaces Realm?
As far as I know nobody has ported Realm to Codename One. You could potentially port it using native interfaces, but before spending time on that, I would probably look at the existing cross-platform database options that Codename One already supports.
Existing built-in options include Storage, File System, and SQL, which are all discussed in the developer guide.
I generally try to use Storage if possible as it is very simple and the most portable. If you really need an SQL database, then use the SQL facilities.
I also developed a data access library to provide an extra layer of encapsulation on top of SQL. It provides some nice features like database versioning/updating, and DAO (data access objects) so that you don't have to use SQL for such routine tasks of loading, searching, and saving objects.
On the server-side, you can use any REST interface. E.g. you can set a Java web service with a MySQL database, or a PHP-powered webservice using Xataface, or use a BaaS using the Parse CN1lib.
If you're doing a calendar App, you might also want to explore using Google Docs as your data store as they provide good REST APIs for interacting with calendars.
Lots of options available to you.
Is it possible to take the backup of mysql database using hibernate ? Share your ideas.
I am using hibernate mapping xml for pojo mapping with table.
AFAIK, Hibernate not providing features for backup or restore.
How ever you should consider to do it from command line, which you can execute through java.
Downloading MySQL dump from command line
Hibernate does not provide database backup functionality and here is why,
Hibernate is an OR mapping tool and primarily aimed as objectifying the database so that the code developers don't have to bother about databases interaction intricacies and never have to work with database directly.
Database backups are taken by DB administrators (and not developers) who very closely work with the databases and are familiar with tools and terminologies. Hence tools like hibernate do not have any role here to play.
Here follows some solutions
You can create hibernate with ant for restore/backup database This Link provide more information about that
Here follows another solution for backup/restore tables programatically using hibernate
I have with me a java app that uses mysql-- now I have converted the database to SQL Server- but I need to convert the code of the java app so that it now uses SQL Server.
This java app uses Struts and Hibernate
What all things do I have to keep in mind to make this conversion?
hibernate should make the transition seamless for you.
Make sure to choose the correct driver as some drivers might act differently.
I personally like jtds. It has vast documentation.
Look for native queries in your code because they might need some modifications.
Other than that, I don't think you should experience any problem.
I had an application that supported oracle, SQL-Server and mysql and we didn't have specific code for each one.
EDIT : as maba suggests in the comments, you will need to modify the hibernate configuration a bit (driver, dialect, url ).
For more hibernate specific configuration, I found a great stackoverflow answer
We have an application (Java) with an own OR mapper. Within this system we have what can be compared to Hibernate's interceptors (we call it triggers): Do specific actions just before saving data in the database, after it's deleted and so on. The underlying database is MySQL.
Now we would like to use tools such as Pentaho Data Integration or Talend to convert data to put it into our system. It's no problem to do that directly on the SQL level, but by doing so we loose the built-in power of our triggers.
Is there a way to somehow integrate any of the Data Integration solutions into our existing application? It would be great if there was a way to write into instances of our classes instead of writing into the database directly.
Any hints welcome :-)
I'd prefer Talend which is a Java code generator tool. (You can se my blog post at http://www.robertomarchetto.com/www/talend_studio_vs_kettle_pentao_pdi_comparison)
You could use a tJavaRow so you can write Java code for each processed row. In tJavaRow you can call Hibernate code, for example using a custom class defined in a new routine.
2 ways with Pentaho data integration I can think of straight off:
Simply create a plugin which adds/deletes data - you could copy the existing salesforce insert/update plugins, they would be a good start - rip out all the salesforce code and replace with yours.
Perhaps harder; But maybe more satisfying - Write a jdbc driver which uses your code!