Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easy way to store Java objects to MySQL? [closed]

Tags:

People also ask

Can you store Java objects in MySQL?

Create Hibernate Entity Java class which will be stored in MySQL Database. Create MySQL Data Access Object which will be used to take the Entity object and store it in MySQL database. Create Service Layer Interface and Service Layer Interface Implementation. Create Root Resource and a RESTful Web Service End Point.

Can we store objects in collection in Java?

Yes, since objects are also considered as datatypes (reference) in Java, you can create an array of the type of a particular class and, populate it with instances of that class.


Let's say I have this kind of Java object:

String brand = "Toyota";
String model = "Corolla";
int year = "2013";

CarBean car = new CarBean(brand, model, year);

How to store easily this object to MySQL? I've done JDBC succefully and tables are working, but there is always something that gives me grey hairs.

What would be easy (but at least semi professional) way to store/retrieve data back and forth with NetBeans and MySQL?