Sorry, I am curious if is possible (and if it is, how is possible) to set up the database on what is hibernate working from a running web application, well something like to modify properties.xml or hiberanete.xml from a page of the site.
Thank you,
Vlad.
Related
I am very familiar with the .net framework. but new to java technologies. I am working on data-driven web application (using Netbeans, MySql, Glassfish) for my course work.
I have spent weeks trying to figure out how to use JPA technology for my JSF interface based web application. My assumption is that it is similar to entity framework in .net. I have searched and searched but it seems the videos/tutorials/explanations are for java people only.
If there is anyone who has transitioned from .net to java succesfully or who understands both platforms to help me.
I have created the entity classes so far, so I want to know what to do to be able to -
-Get and manage instance of entities from database,
-Manipulate and navigate through the entities
-Then save changes back to the database.
(just like in .net using the context.entityname.add(new entityInstance) and context.SubmitChanges() method to save changes back to the database.)
so how can I set the entity manager up and get it to work assuming I want to use it in a Managed Bean class backing my JSF pages.**
If I try to follow the documentation or tutorials from a java only based developer. I find it very difficult to understand.
A link to an article from a .net perspective can also be helpful.
Thanx alot.
I am having problems using my DAO (Data Access Object) classes on my servlets.
Everything works fine in a simple main method when not deployed on the server, but using the same classes in my servlets doGet methods seems to have no effect on database. I still get the query messages on console, for example:
Hibernate: select something_id.something from something
but nothing returns...
Im using a memory database (jdbc:hsqldb:mem:db1) and EntityManager to insert and retrieve from it (mostly createQuery()) in my DAO classes methods.
Im testing on eclipse localhost server preview. Tried Tomcat and Glassfish also, but they didnt seem to change anything so I returned to the default.
Does anyone know what am i doing wrong or what might be the issue?
I cant provide any specific code right now, because it is in my work computer, but i will in approximately 12 hours if its needed to help solve this issue.
EDIT
Solved my problem. I foolishly executed my database schema creation file with every get request and thats why the queries didnt seem to work :). I'll be more thorough next time!
We have a web application that uses Spring/JPA/Hibernate. Currently we are using SolidBase for database change management, which works well in a managed deployment model - however we are now migrating to a non-managed deployment model where users will be able to download the web application. We are building an "Update-Center" type functionality for the web application and are trying to figure out how we should apply database changes.
Ideally, I would like the application to apply any pending database changes at application startup and I would like this to be something that we can code pro grammatically but I don't want to rewrite Hibernate's SchemaExport functionality to do it.
Does anyone have any recommendations, patterns, or best practices on how we can best implement this functionality in to our application?
Is there any update-center application libraries that will solve our problem (I haven't been able to find a single one)?
I discovered this article while researching this
http://www.infoq.com/news/upgrade-frameworks
This led me to this post
http://www.jroller.com/mrdon/entry/transparent_sql_schema_migration_with
Which ultimately led me to rolling my own solution to this problem using Apache DdlUtils and the BeanFactory solution offered in the jroller.com blog post.
This ultimately will be a component that can be dropped in to any application, legacy or new to implement update functionality into a web application. It will use XML to apply database updates and with the use of DDL it means that the package will work against any supported database. The updater will also support updates to filesystem resources and data itself (as opposed to schema)
I do not work for BitRock.
This may not be exactly what you are looking for, but I have used InstallBuilder from Bitrock to manage these types of updates for distributed applications. This is the same installer package that the PostgreSQL team uses. It was pretty straight forward to get this working, with minimal headaches. Especially when compared to other installer programs.
I've got a webapp which uses spring+hibernate for my data layer. I'm using 2nd level caching with ehcache as provider. Everything seems to work so far but sometimes we encounter a problem which I can't really figure out atm.
One of my tables is used for labels within the application - every user who logs access this table with his set language. Works for 90% of the time. But sometimes the user gets labels for the wrong language, e.g. instead of german everything turns to italian.
After a logout and login all labels are correct.
Does anyone of you encountered something like this? I'm not sure where to look at: spring+hibernate+ehcache is a solid package or is it not?
Cheers
Spring/Hibernate/EhCache is a solid stack, I'm 99% sure it's a bug in your code.
Any chance the labels are cached statically somewhere in your application?
Make sure equals and hashcode are proprerly implemented in your entity classes, you can find insights on how to do it here
Try to remote debug your server, set breakpoints in your DAOs to check that the data is actually fetched.
Currently I'm building my Java Web Application on Google AppEngine (GAE), but due to a lot of limitations they have I'm afraid that I'm going to have to switch from GAE to my own server which is running Glassfish (or I can setup any other server if needed). Also I'm planning to run Oracle or MySql databases. What do I need to do in order to switch from GAE to my server? Do I need to rewrite my code? Should I continue using Datanucleus or switch to something else? Anything else?
Why not follow the info given in the original Google campfire ? There was a presentation by IBM on how to run an AppEngine app using DB2. They simply dropped the datanucleus-rdbms jar in the CLASSPATH, changed the connection URL etc, and ran it. Like in this PDF
http://download.boulder.ibm.com/ibmdl/pub/software/dw/wes/hipods/GAE_Java_Interoperability.pdf
--Andy (DataNucleus)
We won't be able to give very good advice without knowing how you wrote your app. Did you create a data access layer that separates your datastore access from your business logic? Or do you pass app engine specific objects all over the place? Are you using the gae user service? or memcache?
The first thing you should do is look at all your import statements. Anytime you see a com.google.something in there, you know you need to change that. You didn't give much detail about how you wrote your app, but if you are asking about datanucleus you probably were using JDO or JPA, which means you may be able to reuse most of your data layer. You might have a bunch of Key fields which you'll have to change, and maybe a few gae specific annotations. You'll probably have to double check how you handle transactions, as that is likely to be different in a SQL database, which don't use entity groups like GAE does.
I haven't tried but there is an open source implementation of GAE called appscale http://code.google.com/p/appscale/