Are there tools to generate a ddl schema from JDO annotated pojos? - jdo

Perhaps i'm wandering down the wrong path - I'm looking for a tool like hbm2ddl.
I currently have domain model (pojos with JDO annotations) - I need to setup the database.
I want to experiment with a few database types - HSQLDB, Google App Engine, Oracle.
Can anyone offer advice on how to proceed?

You mean DataNucleus "SchemaTool" that generates the schema direct, or creates a DDL file ?
Obviously that will not work for AppEngine since it has no "schema" and is not an RDBMS

Related

How to structure models and use Doctrine in Symfony2

I am switching over to Symfony for a project that I am working on but I need a little advice on how to structure the files when it comes to models and using doctrine.
I have a custom framework that I use, which in turns uses the MVC model. Pretty much all of my MYSQL database queries are stored in the models and I access them through the controller.
Now after looking at Symfony2, my interpretation is that "model" files in Symfony are called Servies. Is this correct?
I have also generated a number of Entities that correspond to my MYSQL database. My question here is do I place my custom Doctrine queries inside the Service files or do I create them inside the Entity files?
I'm a little unsure how to structure this.
Thanks
Pretty much all of my MYSQL database queries are stored in the models
That's bad, but I'll mention about it later.
Now after looking at Symfony2, my interpretation is that "model" files in Symfony are called Servies. Is this correct?
Queries should be done in either repositories or in some cases in services.
If your query returns entities, then it should be repository for sure.
My question here is do I place my custom Doctrine queries inside the Service files or do I create them inside the Entity files?
Entities should be plain PHP objects. They shouldn't depend on anything than other entities. Entities actually doesn't even know anything about database. It's pure object oriented business logic.
Again, all DB queries should be in repositories or services.
I would suggest to go through Symfony Book in first place, to get idea of how "the Symfony way" works.
Symfony is not MVC framework:
Symfony2 is really about providing the tools for the Controller part, the View part, but not the Model part [...] Symfony2 is an HTTP framework; it is a Request/Response framework.
And it is great. Symfony allows to make your model as you wish without any restrictions. The Doctrine (ORM and/or DBAL) is a separate set of libraries. You can use any other library, or build your own persistence layer abstraction, or work with native SQL through PDO/MySQLi/etc.
Service is just an object that registered in the container and have some dependencies. Services can doing anything. They can represent your model, but it is not a requirement.
Organizing Your Business Logic (The Symfony Best Practices)
Doctrine ORM Best Practices

Looking for an example of how to use ServiceStack.OrmLite to auto gen Entities from an existing SQL Server Schema

I see that ServiceStack.OrmLite Lite has this.
I feel like something is not sinking in with this statement from ServiceStack,
problem with Code-Gen DTO's changes breaks code, ihibits DRY forces abstraction, mutiple versions in parallel implementations
Seems to me that it means using full ORM with SS instead of a micro orm would be doing exactly this or am I way off here? I am not really sure since I auto-gen the entities but hand code the dto's.
The quote was about Code-Gen DTO's, e.g. like the development workflow WCF/SOAP encourages when you use Add Service Reference dialog or svcutil.exe to generate a client proxy.
This has nothing to do with Code-First ORMs and Data Models that OrmLite promotes.

Is it possible to do model-first ORM mapping with ServiceStack and OrmLite?

I'm just discovering ServiceStack for the first time this weekend and I find it completely amazing. As such, I'm already in the process of converting all of my projects over to it. Then I ran into a small snag.
I can't find any documentation that mentions using OrmLite starting with the database first and then mapping an existing schema into POCOs.
I've found plenty of material on code-first, but nothing on model-first.
Is there a way to use OrmLiite taking a model-first approach?
Thank you.
OrmLite is primarily a code-first ORM, but if you want to start with an existing database you would just create a POCO with properties that maps 1:1 to an existing Table and columns.
It's trivial to infer a POCO manually, but if you want some code-gen tool to help do this, OrmLite includes a couple of T4 scripts you could use instead.

Simple Data access / download ASP.NET

I am a winforms programmer and need to setup a data access website for our sql server database. The database contains weather data (wind, temperature, etc..). I would like users to be able to select a start and stop date and the to download the dataset. I know this should be simple to build, but I would like some advise on what is the best technique.
Do I need entity framework? We have a license for Developer Express ASP.NET. Any ideas to use, since I am totally confused about all the options available and I haven't build any ASP.NET website in a long time.....
Thanks,
Erik
For a first pass/prototype, I'd suggest you use ADO.Net and see how it runs with your datasets. Then, once things are clearer I'd maybe look into an ORM. Based on the use case you mention ORM might be overkill.
Yes with license for Developer Express ASP.NET. you can use Entity Framework
If you want work with ORM technology. mapping relational object; yuo have wizard who facilitate your cretaion of database and mapping
http://msdn.microsoft.com/en-us/data/ef.aspx
You can also use just ADO.Net with adapter of datas, stored procedure, dataset datatables, etc....

alfresco database

How can we extend the Alfresco database? I need to add new tables to the existing database structure.
Does alfresco support this?
thanks in advance,
sri..
I think changing the alfresco db model is never a good solution. Some alfresco upgrades are made using Schema Upgrade Scripts, and that could get messy.
Have you tried to extend the alfresco content model?
Alfresco support some data types, allowing you to persist data. The Web Script framework allow you manipulate all your data inside your content model.
If your data is not suitable for a "content model", I think you should create a new database to hold your data.
Well, it is just a database. So you can create as many new tables as you want just like you would in any other database.
Obviously Alfresco won't use them because it doesn't know them, but you can query the tables as you like.
Advices from alfresco engineers are do not touch alfresco database. Please take a look at this page.
http://forums.alfresco.com/forum/general/non-technical-alfresco-discussion/where-alfreso-user-details-are-stored-i-alfresco
Changing alfresco database is not recommended.Content Model will be the good way.If such requirement is mandatory than,
You can use spring with hibernate for database connection.Properties which is required for connecting database are all ready declared inside alfresco-global.properties which is located inside "tomcat/shared/classes/".
For Spring bean injection you can declare beans inside any file which ends with "-context" which resides inside "tomcat/shared/classes/alfresco/extension" folder.
I will still recommend developer to use content model.
Depending on your use case, you may or may not need to play directly with the[/a] data base. I think your use case should fall in one of the following:
Use case 1:
You need to setup some metadata on folders and/or documents. You may have to nest multiple levels of nodes with different sets of custom metadata on each level.
You probably need to extend alfresco models in order to define custom document/folder models that best suits your business requirements. Please check jpotts' tutorial to learn how to do so.
Use case 2:
You need to define multiple lists with different sets of properties, those lists may or may not be linked to some content in your alfresco repo.
You probably need to learn more about alfresco sites' datalists, once you do so you may be interested in learning how to extend OOTB alfresco content model, jpotts' tutorial would be a good starting point, and then you should be checking this tutorial in order to learn how to manage datalists in stand alone aikau apps/share pages.
Use case 3:
You need to leverage a relational database in order to define and leverage you complex business logic that do not fall in any of the use cases defined above.
Are you sure you do not want to code a brand new app leveraging a technology that you are familiar with and have it communicate with alfresco using RESTfull api/cmis/.... ?
Are you sure alfresco is THE way to go ? If so, and you still want to have your custom complex business model in a bare relational database:
Please consider using a separate database instance / database for your custom extension, this way you would be sure any new patch/upgrade to alfresco that may change database structure won't affect your extension (or at least wont give you hard time upgrading it)
If you are really tied to only 1 database instance / 1 database schema, you will probably want to precede your table names with some prefix and hope none of alfresco future upgrades would have new tables with the same prefix. You probably also need to make sure to manage your database config wisely (connection pools ..) so neither your alfresco instance nor your custom extension have to starve. (make sure you close the connections you are opening)
Alfresco and Activiti come with a database. It is not good to access the database directly. Doing so can cause unexpected locking behavior or exhaust connection pools on the DB. This turns out into performance problems and other kinds of issues are possible too. In case you want to update Alfresco or Activiti you can do it through APIs. Easy to extend, easy to customize and hassle free integration capability are some of the reasons which has made http://loganwinson.doodlekit.com/blog/entry/4249216/top-things-to-know-about-alfresco-development>Alfresco web development popular among businesses.

Resources