Link to home
Start Free TrialLog in
Avatar of BNLIND
BNLIND

asked on

How Do I Setup This Project?

I am trying to learn Java because I want to port a C# application to it so it will run on other platforms. I have Eclipse installed and I have used it to create a couple of basic classes from my C# app. What I really want to do is make the application modular by containing the application logic into its own project. Then, create new projects for the different types of front-ends (desktop gui, web-based, etc).

I guess my first question is: Am I thinking about this the right way? Should I make a "core" project, then separate projects for the different types of user interfaces?

Since my application connects to a database, I need to figure out how to work with databases from Java. I would like to have the core handle the database access stuff so that it is transparent to the user interfaces. I have already looked at EclipseLink, but have no idea how to use it or how to install it. None of the documentation or tutorials out there actually explain how to install it or how to use it. All they teach you is how to use annotations on classes, but that's only about 20% of it. You have to do so much other stuff to make this work that everyone just assumes everyone on the planet knows how to do.

So my second question is: How do I get my "core" to handle database access? I am using a PostgreSQL database currently, but I need to also make it work with other database engines/
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

I would recommend you to through some training on Java first.

As per your question,
1) your thinking is correct,
2) You can make separate projects for different interfaces, but as you will learn more about java, you will find that your project can be modularized even further

You need to learn about JDBC to communicate with database using Java

see these links to learn more
http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html
http://java.sun.com/docs/books/tutorial/jdbc/index.html
Avatar of BNLIND
BNLIND

ASKER

It's good to know that I can modularize Java. this was a concern of mine. As for database access, I would really like to avoid using raw SQL. I did that dance with C# and ended up having to write a 2,000 line SQL code generator that could handle MSSQL, PostgreSQL, and MySQL. So JPA (or similar) is almost a requirement for my project since I need it to work cross-database.
for writing a database agnostic db access code you need to use some ORM package.

You can go for Hibernate (Hibernate Query language), or you can also try EQL (EJB Query language)\

But before moving towards these packages, get yourself well versed with Java/J2EE basics
Avatar of BNLIND

ASKER

Also, I have tried getting into some kind of a Java class, but there are no training centers within 100 miles of me that host Java classes. Everything is .NET, stuff I already know. And of course, I don't know any developers, much less Java developers, so I have no one to ask questions. Forums like these help, but can be frustrating when I can't find an answer.
Avatar of BNLIND

ASKER

gurvinder372: Can you recommend some resources in order to get well-versed in Java? The sun docs assume you are using Netbeans. I am using Eclipse, so that complicates things. I have also been unable to find many resources that walk you through the process. Everything I read goes straight from theory to guru code without explaining how to get to that point. I did find this tutorial a few months ago, which was actually pretty good, but very limited: http://eclipsetutorial.sourceforge.net/totalbeginner.html
>>I am trying to learn Java because I want to port a C# application to it so it will run on other platforms.

Have you already tried to build it as is for other platforms?

http://en.wikipedia.org/wiki/Mono_(software)
Avatar of BNLIND

ASKER

CEHJ:
To put it shortly, Mono will not handle p/invoke calls and it doesn't work too well on the Mac. If I ever had a problem with it on a different platform other than Windows, no one would be able to help me. Whereas if I have a problem with Java, practically every Java developer can help. As for p/invoke, Java already has the components I need for my app, so I don't need p/invoke.
Avatar of BNLIND

ASKER

All of the tutorials listed above deal with learning the language/syntax. Except for a couple of things, Java is EXACTLY like C#. It's working with libraries and frameworks that I need help with. Specifically, database stuff. I can port most of my code over from C# with no problem. Again, it's the complex stuff like database access is what I need help with.
Database connectivity you can achieve as follows ;

> Decide which db you want to use . viz MYSQL, MSSQL, ORACLE etc.

> You can search for JDBC driver (It is just a jar file) for that DB.

> Add the JDBC to your run time or you can directly paste the jar file into etc directory of JRE.

Simple implementation you can find at http://www.jdbc-tutorial.com/

Please do note that, you will need to change the class that has to be loaded depending on the kind of driver you are using, rest remains same
ASKER CERTIFIED SOLUTION
Avatar of lokeshkjain
lokeshkjain
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BNLIND

ASKER

The answers provided helped to solve the issue.