Netbeans generate hbm.xml files from multiple shcemas of database - netbeans

i am using netbeans, I am generating POJO and hbm.xml files from a database, but i am able to generate only from one schema only. But I need to create from two different schemas and its tables have cross reference or relationship. How can I do it in Netbeans? or Is there any alternative solution?

Seems it Netbean's bug, while creating an reverse
engineering xml file, actually you can not create them from multiple schemas,
because simply Netbean does not simply generate them. There are several solutions
if you dont want to write by hand all codes in reverse engineering file:
1) First You can generate reverse engineering file from
Eclipse IDE, then you may copy it and paste in the
Netbeans reverse engineering file, then it should
work fine to generate POJO and hbm.xml files;

Related

Oracle Data Modeler generated column name from datamodel too long

I'm trying to create a datamodel in the Oracle Data Modeler module that is available in Oracle SQL Developer. I would like to maintain my data dictionary from this model. To do this (I think) I need a generated DDL file for which the attributes are not longer than 30 characters.
I have just discovered Oracle SQL Developer and am completely new to creating these kind of models. What I have done so far. I have created a logical model and have engineered it to a relational model. From the relational model I can then generate DDL scripts that I can run on the database to make the changes I want.
When doing this I run into a problem. When engineering the logical model to a relational model I can see that the foreign keys I have made become more than 30 characters. This is because it seems to generate the name as (see picture)
From searching it seems you should be able to fix this with naming standard templates. I have looked for this menu option but can't find it. I have found the name abbreviations functionality for which you can upload .csv files but I think this is for something different.
Rightclicking on the logical model in the datamodeler browser view gives me the opportunity to Apply naming standards, but this gives me a message that I should turn off the keep as the name of the originating attribute option (see picture). I have looked for this but can't find this option.
My version of Oracle SQL Developer is 4.1.3.20, Build MAIN-20.78.
Please let me know if my story is not clear. Thanks.
Generated column name
Applying name standards message
You will find the option under Tools/Preferences/Data Modeler/Model/Logical

Is there any way to use Linq To Entites without `.edmx` file?

I created Model1.edmx file and accordingly Model1.Designer.cs was also created.
I decided to copy all code from Model1.Designer.cs to dal.cs file and deleted Model1.edmx + Model1.Designer.cs files.
When I try to connect I get error that mapping is failed and no SSDL,CSDL are found.
Is there any way to use Linq To Entites without .edmx file, but just using the code in Model1.Designer.cs?
If you define your mapping in EDMX there is no way to use it without EDMX. EDMX is necessary because the build process will decompose the EDMX files into multiple resources specifying mapping between classes and database. These resources are used at runtime.
If you don't want to have EDMX file you can't use it at all and instead you can try code first approach (more tutorials are available on that page) in Entity Framework 4.1. You can also use helper EF Power Tools to generate code mapping from existing database for you (it can be good to start learning how to map tables from code).

Entity framework - create the csdl, ssdl and msl files

I work with EF 4 (not with Self-tracking entities currently). I've added some columns (non of them is a key and all of the are nullable) to one of my entities, and got the Number of members in conceptual type does not match with number of members on object side type exception.
I've followed the accepted answer here but all I got from that was that this entity does not appear in my edmx anymore. I've re-added it from DB, but I keep getting the same exception.
I think the problem is that I've copied the csdl/ssdl/msl files to my executing assembly directory. I'd like to copy the updated files, but they're not created again (they were once created in the obj\Debug\edmxResourcesToEmbed folder of my EF project), not even after removing them.
Any way to get those files created again?
Thanks.
P.S: As I don't want to publish excess amounts of code, I don't add anything yet but I'll be happy to add needed information, I'm just not sure what exactly is needed.
So if you want to create the csdl, ssdl amd msl files, do the following:
Go to your edmx file.
Click on the GuI screen that shows the model.
Switch to the property window (I didn't know that it needs to be accessed from the GUI area and not by right clicking the file in the Solution Explorer.
In the Metadata Artifact Process select Embed in Output Assembly.
Done and done, the files will appear in Debug\edmxResourcesToEmbed under obj or obj\x86, depends on your build definitions.
I'm sorry if this seems to simple to explain, but I was in need for those instructions (msdn was not a great help) and I hope it might help others.

Entity Framework - separate class files

I am playing around with the latest Entity Framework, and I would like to separate the generated classes into 1 file per class if possible.
I also want to be able to re-generate these files after splitting.
Although this question asks the question, it is old and the accepted answer is "maybe in the future." Split EDMX for Entity Framework - Breakout object layer into separate files - possible?
Is it possible to do this? If so, how do I go about doing this?
Thanks
Use EFv4 and T4 template (for entity objects or POCOs). It will create separate file for each created entity. I'm not sure why you want it. It is generated code which mustn't be manually modified because modifications will be lost during next regenerating.
Breaking EDMX insto separate files is somehow possible but pretty hard - it is manual work. Check these articles (part 1 and part 2). It is approach for working with large models.
Entity Developer for SQL Server provides some enhancements for large EF models handling, like multiple diagrams. As for the code generation, there is a File Per Class code generation option as well.
Forget the generation crap and start with the latest EF and use the code first approach. You then have complete control over the POCO. I am still a bit underwhelmed on EF, but the code first approach will allow you to create the classes as you like and then link them in to ORM bits. If you don't want to write your own classes, I know of no way to achieve what you desire.

How do I generate Entity Framework 4.0 classes from the command line that have different names than my schema objects?

I want to generate Entity Framework 4.0 classes from a (legacy) database from a command line, but I have 2 transformations I want:
Tables/columns are lowerCamelCase and I want my classes/members to be UpperCamelCase.
I want to suffix my classes with "Dto".
Any idea how this might be accomplished? I'm a total newbie to EF, but I have a decent understanding of Linq to Sql and was able to accomplish the same task by doing: sqlmetal -> dbml -> xml mapping file and .cs file.
The EDMX is also XML. If you're comfortable with XML transformations, just change the CSDL section of the file per your renaming rules. Then do a full build on your app and the code should be regenerated. To do this from the command line, use EdmGen, which comes with the framework. The free EdmGen2 utility is worth a look; it may already do some of what you need.