As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am about to start a new project that will use the Play! 2 framework for Scala, probably using Squeryl as ORM (but maybe Slick would be fine too, if it ready in time).
Now, Play! has a feature to upgrade your database using migrations. Unforunately, these migrations are written in SQL. This is not only an inconvenience (I would like to be able to write migrations in Scala) but has two problems
first, I need to write migrations on my own. I am used to South, that is able to infer schema migrations by looking at the current and previous definitions of my models;
second, it would be very cumbersome to handle data migrations. One may have the need to alter data programmatically, and this may not even be doable in plain SQL.
So, I am looking for an alternative. I was not able to find any migration tool for any Scala ORM that would generate schema migrations automatically, is there any?
The best tool I could find is Scala migrations. Is there a way to make Play! automatically use it in place of its own migration tool?
Another alternative is Flyway, but it will not solve your integration issue.
For that, either you can implement a Plugin as it is done with standard Play! evolutions, either you could use the Global object to start the migration on the application start.
Evolutions in Play2 is implemented as a plugin. You could examine its implementation and roll your own along the same lines. As far as I can see, there isn't a simple way to just swap out the implementation for another.
One other tool that might be worth looking at is Liquibase. It is implemented in Java so should be easy to use from Scala.
I recommend liquibase. Liquibase is an open source, database-independent library for tracking, managing and applying database changes. It is built on a simple premise: All database changes are stored in a human readable yet trackable form and checked into source control. Liquibase can be used for both Java and Scala. The great thing about Liquibase is that you can use either XML, SQL, or combination of both for your db migration needs. It is easy to set up and use and has very extensive documents.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
When I execute a command against a redundant SQL configuration (such as SQL Azure), I sometimes get timeouts and other misc. errors that are due to a server being shutdown or failing. On Azure this isn't a problem, since redundancy is built-in. The correct action is to re-attempt the query with a new connection, and most likely the load balancers (or whatever) will kick you over to a server that's functioning properly.
My question is whether there is a way to have Entity Framework (v4 or v5) do this automatically? Wrapping every query with a try/catch block (that reattempts the query if certain errors are received) is impractically, and I feel confident that there's a solution to this problem that I'm overlooking.
For related information about SQL Azure's random closing of connections, see: http://msdn.microsoft.com/en-us/library/ee336245.aspx#cc. However, as of late, I have not gotten this error from Azure at all... I just got the occasional, sporadic SQL timeout.
have a look at the Transient Fault Handling Framework from SQL CAT :
http://windowsazurecat.com/2010/12/sql-azure-and-entity-framework-connection-fault-handling/
=== Added by #pbarranis ===
According to that same site, but a different page:
The Transient Fault Handling Framework has been superseded by a newer
deliverable from the Patterns & Practices team. It is now called the
Transient Fault Handling Application Block and comes in all 3 flavors:
•Developer guidance:
http://msdn.microsoft.com/en-us/library/hh680934(v=PandP.50).aspx
•NuGet package:
http://nuget.org/List/Packages/EnterpriseLibrary.WindowsAzure.TransientFaultHandling
•Source code:
http://nuget.org/List/Packages/EnterpriseLibrary.Source.WindowsAzure
The new Transient Fault Handling Application Block is now our
officially recommended approach to handling transient faults in the
applications running on the Windows Azure platform.
If you use Entity Framework 6 (currently in alpha) then there is some new in-built support for transient retries with Azure SQL Database (with a little bit of configuration): http://entityframework.codeplex.com/wikipage?title=Connection%20Resiliency%20Spec
I've created a library which allows you to configure Entity Framework to retry using the Fault Handling block without needing to change every database call - generally you will only need to change your config file and possibly one or two lines of code.
This allows you to use it for Entity Framework or Linq To Sql.
https://github.com/robdmoore/ReliableDbProvider
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have a transformation sequence of models that eventually outputs an EMF model, instance of some EMF Meta model (the meta model I defined myself).
I am looking for a good way to generate code from this. Of course, there is XPand, I used to use that for other projects, but I wonder if XText or XTend is a suitable alternative (since it's so actively developed).
In other words, I have an EMF model, don't need an editor for it (so don't need XText for THAT purpose), but I DO need to build a code generator. Could I use XText for only that part?
And would it be advisable over XPand or Acceleo?
Any advice would be great.
I try to do a fair comparison between the tools, but it is really hard.
Xtext has nothing to do with code generation - it is for creating editors and parsers.
Xtend2 is designed as a successor of Xpand with a similar syntax - however, it is not tailored specifically to code generation but as a general purpose language that is nicely usable for code generation as well. The main difference between other generation engines is that you work on the source code level (basically, Xtend2 translates to Java), and you have to provide your own engine that drives the generation - although of course it is possible to use Modeling Workflow Engine for this reason - just as in case of Xpand.
Acceleo is more tailored for simple code generation. It's syntax is based on an OMG specification for code generation, and provides a full-featured IDE for developing code generation. However, if you need complex control structure during code generation, it might be not the best solution.
About M2T-JET, as Chris suggested, I would vote against, except for very specific needs. It's development support is much weaker (e.g. it's editor), and is more based on the idea of having a single template for output opposed to a higher level, rule based approach of Xpand/Xtend/Acceleo. This results in somewhat better performance during code generation, however, it often results in harder to understand templates. Ignore this paragraph because it is too negative.
Alltogether, if you are using only EMF models, both Acceleo and Xtend can be a nice choice for code generation, and you should choose between them based on your (or your teams) expertise and your more specific needs. If you need to support both EMF models and other data sources, then Acceleo is not the best choice; however, neither JET nor Xtend builds on the fact that your input is an EMF model, but provides easy way to call any Java code available.
I recommend M2T-JET. It's a text template based transform that uses multiple templates to generate projects, folders and files from a single input model. The model can be EMF and the templates let you navigate through and iterate over the model to produce the Eclipse resources you have in mind.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am developing a gwt project and am looking for an appropriate server side technology.
it should support be open source and support user login (and not using openID...) with password recovery etc
it seems that the de-facto standard would be spring + hibernate. however, I am unfamiliar with neither of them and understand that the learning curve (especially for spring) is very high. gwt was quite easy to learn using GOOG's excellent online tutorials but the spring equivalent seem to impose lots of configuration files and deeper understanding of its internals.
so I am looking for a simpler server side technology to deploy my gwt app. I am definitely prepared to learn a new framework if necessary but not something that would take me 2 months just to understand the fundamentals...
any ideas...?
Spring Roo should get you started with a GWT app in no time. It even has scaffoling (like Rails) for easily generating code for views and models. Here is a good video that introduces Roo and here is a guide for the mandentory 10 minutes application that Rails pioneered years ago.
Also a cool thing about Roo is that it gets you started quickly while still doing everything correctly (i.e. integrate with Spring security, Hibernate, Maven, ...).
Edit: You could also try Vaadin (tutorial here) although I am unsure if that may be to simplistic for your needs.
You could have a look at Google AppEngine + GWT. It provides you a full development environment:
http://code.google.com/webtoolkit/doc/latest/tutorial/appengine.html
This post also provides some information on how to get started with Google Plugin for Eclipse, which supports GWT, Google AppEngine, etc.
I second using Google App Engine, especially the Java version as it integrates so easily with GWT. I am using it in this way right now. App Engine has well written and complete docs, similar to those of GWT.
A simple way to integrate the build processes is to (1) use the GWT code generator to generate the standard project tree and ant build process and then (2) read this article on integrating GAE/Java with GWT:
https://developers.google.com/web-toolkit/doc/latest/tutorial/appengine
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I would like to know the pros and cons of using EF4 Code-First approach. Can we duplicate all features that EF4 generated classes offer like Lazy Loading, loading related entities, etc?
Thanks
Pros
Lightweight entity classes or POCO based.
More control over entity classes since you code them yourself rather than depending on EF to generate them. This means you don't have to define partial classes to do data annotations.
Option to never have to specify mapping anywhere. Convention takes over configuration.
DbContext follows the repository pattern.
Lazy loading, related entity loading all taken care of for you. For example a Post model can declare Author model in the POCO and EF Code first will map this relation automatically. Again use of convention makes us so productive.
Works great for greenfield applications.
ASP.NET MVC view generation works great.
ModelBinder works as per normal.
Cons
No API support for customizing the database mapping convention like in Fluent nHibernate.
Bit difficult to map to existing databases.(This might change in the release version).
For sample code and mapping to existing databases using EF 4.0 Code First see this blog post.
http://theminimalistdeveloper.com/2010/07/28/how-to-map-pocos-to-existing-databases-in-entity-framework-4-0-code-first-and-asp-net-mvc-2/
Cons:
Since you have no EDMX, you can't pregenerate views
Not yet licensed for go-live. Hopefully, this will change soon.
Pros
Since there is no fixed schema, you can dynamically build one at runtime.
Most other things are exactly the same (lazy loading, explicit loading, etc.). A few more are matters of personal preference (the API).
Since you asked specifically about Lazy Loading, here's a writeup showing Working with Lazy Loading with Entity Framework Code First, where it's enabled by default. To specifically answer that part of your question, yes with Code First you still get the benefits of Lazy Loading, and in fact as the post shows, you have very fine-grained control over this feature.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Which tools or libraries do you wish existed in the Scala ecosystem?
Are there any existing ones you wish were greatly improved?
In no particular order:
A Scala version of the Clojure Incanter libraries would be very handy indeed, and could probably be even nicer to use than Clojure's.
It would also be exceptionally cool if the parallel version of the 2.8 collection library had been ready for (todays!) 2.8 release, rather than waiting for 2.8.1. Even cooler would be something with the power and feel of the 2.8 collection library which offloaded calculations to something like Hadoop.
Standard library support for software transactional memory would be very nice.
The IntelliJ IDEA plugin for Scala is an amazing piece of work, but (unsurprisingly) still lags behind Java in some annoying ways, particularly in on-the-fly error reporting.
There need to be some standard shims built so that various "enterprise" libraries (Spring/Hibernate/Ibatis/Freemarker, etc.) can use Scala objects without scattering #BeanProperty annotations around and without using Java collections objects.
A single lib for time, money and physical units would be cool
Scala Swing should be more complete (and more consistent)
Would be nice if the DBC lib for wrapping JDBC access would be finished
A Scala 3D engine would be awesome. Simplex3D and Sgine are on the way, but it's a long way...
I think it is important not to pack too much functionality into Scala. It is really easy to expand Scala on your own, so let's do that for a while. Then, when some framework emerge as a winner, this might shipped with Scala.
For those of you who have suffered the result of the JCP committee, please remember the disasters of premature standardizations.
That said, I have my own wish list :-) I would like a simple DSL for Date. The one from DPPs book would do.
Off the top of my head:
A good scala <-> JDBC bridge.
A good mocking framework.
Scala wrapper for Spring DI.