Unable to map database to POJO using hibernate in netbeans 13 (Ubuntu 22.04)
I am using Netbeans-13 with Ubuntu-22.04 and trying to map a database with some POJOs in my spring project using hibernate plugin available in netbeans. But in the mapping wizard, I am unable to select hibernate configuration file/ hibernate reverse engineering configuration file as they are not listed in the drop-down menu.
How to resolve this issue?
New Hibernate Mapping Files and POJOs from Database:
do you know?
how many words do you know
See also questions close to this topic
-
Hibernate handles id assigning instead of database
I have an auto-increment PK in a table and I want hibernate to handle id assigning instead of database. As my understanding the
@GeneratedValue(strategy = GenerationType.IDENTITY)
lets the database generate a new value with each insertion operation. So do we have any different solution to handle it? -
Some table rows are not returned by hibernate native query
I'm having a big problem that a few rows of the table are not returning by the native query of hibernate (Spring Data), although if I put the same query in the database it returns. No exceptions or warnings appear in the log. My database is MySQL.
Follows the query:
@Query(value = "SELECT MID(UUID(),1,36) as unique_key, " + "TRIM(avio_sinr.num_sinr) as num_sinr, " + "avio_sinr.dat_alte_regc, " + "avio_sinr.dat_cria_sinr, " + "avio_sinr.vlr_limi_inde, " + "avio_sinr.vlr_pgto_sinr, " + "TRIM(avio_sinr.cod_apol_prco) as cod_apol_prco, " + "ctto_usua_prco.nom_emai_usua_prco, " + "ctto_usua_prco.num_cell_usua_prco, " + "ctto_usua_prco.cod_ddi_tel_usua_prco, " + "ctto_usua_prco.cod_ddd_tel_usua_prco, " + "ctto_usua_prco.cod_ddi_cell_usua_prco, " + "ctto_usua_prco.cod_ddd_cell_usua_prco, " + "dado_pgto.bco, " + "dado_pgto.cod_tipo_cont_bace, " + "dado_pgto.agencia, " + "dado_pgto.num_cont_clie, " + "dado_pgto.num_digt_verf, " + "ende_prco.id_cep_logr, " + "ende_prco.nom_bair_usua_prco, " + "ende_prco.nom_cida_usua_prco, " + "ende_prco.nom_logr_usua_prco, " + "ende_prco.num_ende_usua_prco, " + "ende_prco.sg_uf, " + "ende_prco.txt_cmpl_usua_prco, " + "even_ocro.cod_ramo_sega, " + "even_ocro.nom_even_infd, " + "gara_disi.cod_gara_sinr, " + "gara_disi.cod_cobt, " + "gara_disi.cod_prod_segu, " + "gara_disi.des_gara_sinr, " + "gara_disi.nom_gara_sinr, " + "prco_abet_sinr.num_prco_sinr, " + "prco_abet_sinr.dat_hor_abet_prco, " + "prco_abet_sinr.dat_ocor_sinr, " + "prco_abet_sinr.hor_ocor_sinr, " + "prco_abet_sinr.num_funl_cola_cogl, " + "prco_abet_sinr.num_funl_rspl_regc, " + "prco_abet_sinr.txt_ocor_sinr, " + "situ_prco.nom_situ_prco, " + "situ_sinr.nom_situ_sinr, " + "tipo_rela_solt_benf.cod_tipo_rela, " + "tipo_rela_solt_benf.des_tipo_rela, " + "tipo_rela_solt_benf.nom_tipo_rela, " + "usua_prco.cod_sexo, " + "usua_prco.cod_tipo_pess, " + "usua_prco.nom_cpto_usua_prco, " + "usua_prco.num_cpf_cnpj_usua_prco, " + "segu_prot_prec_clie.vlr_ofrt_clie, " + "decs_avio_sinr.dat_hor_decs, " + "decs_avio_sinr.txt_decs_anai " + "FROM prco_abet_sinr prco_abet_sinr " + "LEFT JOIN avio_sinr avio_sinr ON (prco_abet_sinr.num_prco_sinr = avio_sinr.num_prco_sinr) " + "LEFT JOIN situ_sinr situ_sinr ON (avio_sinr.cod_situ_sinr = situ_sinr.cod_situ_sinr) " + "LEFT JOIN situ_prco situ_prco ON (prco_abet_sinr.cod_situ_prco = situ_prco.cod_situ_prco) " + "LEFT JOIN usua_prco usua_prco ON (prco_abet_sinr.cod_usua_prco = usua_prco.cod_usua_prco) " + "LEFT JOIN ctto_usua_prco ctto_usua_prco ON (usua_prco.cod_usua_prco = ctto_usua_prco.cod_usua_prco) " + "LEFT JOIN dado_pgto dado_pgto ON (prco_abet_sinr.num_prco_sinr = dado_pgto.num_prco_sinr) " + "LEFT JOIN ende_prco ende_prco ON (usua_prco.cod_usua_prco = ende_prco.cod_usua_prco) " + "LEFT JOIN even_ocro even_ocro ON (prco_abet_sinr.num_prco_sinr = even_ocro.num_prco_sinr) " + "LEFT JOIN gara_disi gara_disi ON (avio_sinr.cod_gara_sinr = gara_disi.cod_gara_sinr) " + "LEFT JOIN tipo_rela_solt_benf tipo_rela_solt_benf ON (usua_prco.cod_tipo_rela = tipo_rela_solt_benf.cod_tipo_rela) " + "LEFT JOIN segu_prot_prec_clie segu_prot_prec_clie ON (prco_abet_sinr.num_prco_sinr = segu_prot_prec_clie.num_prco_sinr) " + "LEFT JOIN decs_avio_sinr decs_avio_sinr ON (avio_sinr.num_sinr = decs_avio_sinr.num_sinr) " + "ORDER BY avio_sinr.num_sinr AND avio_sinr.dat_alte_regc DESC " + "LIMIT :offset, :limit ", nativeQuery = true) List<MovimentacaoSinistroEntity> findByProtocoloSinistroPaginacao(Long limit, Long offset);
Follows the class:
@Entity @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder public class MovSiEntity { @EmbeddedId private MovPK movSiPK; @Column(name = "num_sinr") private String numberSi; @Column(name = "cod_gara_sinr") private Integer codeWarrantSi; @Column(name = "dat_alte_regc") private LocalDate dateAlteracaoRegistroSi; @Column(name = "dat_cria_sinr") private LocalDateTime dateCriacaoSi; @Column(name = "vlr_limi_inde") private BigDecimal valueLimiteIndenizacaoSi; @Column(name = "vlr_pgto_sinr") private BigDecimal valuePagamentoSi; @Column(name = "dat_hor_abet_prco") private LocalDateTime dateOpenProtocol; @Column(name = "dat_ocor_sinr") private LocalDate dateOcorrenciaSi; @Column(name = "hor_ocor_sinr") private Time hourOcorrenciaSi; @Column(name = "vlr_ofrt_clie") private BigDecimal valueOfferClient; @Column(name = "dat_hor_decs") private LocalDateTime dateHourdecision; @Column(name = "nom_emai_usua_prco") private String emailUserProtocol; @Column(name = "cod_ddi_tel_usua_prco") private Short codeDdiTelUserProtocol; @Column(name = "cod_ddd_tel_usua_prco") private Short codeDddTelUserProtocol; @Column(name = "cod_ddi_cell_usua_prco") private Short codeDdiCelUserProtocol; @Column(name = "cod_ddd_cell_usua_prco") private Short codeDddCelUserProtocol; @Column(name = "bco") private String codeBanco; @Column(name = "cod_tipo_cont_bace") private String codeTipoAccountBacen; @Column(name = "agencia") private String agencia; @Column(name = "num_cont_clie") private String numberAccountClient; @Column(name = "num_digt_verf") private String numberDigitoVerify; @Column(name = "id_cep_logr") private String cepplace; @Column(name = "nom_bair_usua_prco") private String bairroUserProtocol; @Column(name = "nom_cida_usua_prco") private String cidadeUserProtocol; @Column(name = "nom_logr_usua_prco") private String placeUserProtocol; @Column(name = "sg_uf") private String siglaUnidadeFederacao; @Column(name = "txt_cmpl_usua_prco") private String complementoplaceUserProtocol; @Column(name = "nom_even_infd") private String nomeEventoInformado; @Column(name = "des_gara_sinr") private String descWarrant; @Column(name = "nom_gara_sinr") private String nomeWarrant; @Column(name = "num_funl_cola_cogl") private String funcionalColaboradorConglomerado; @Column(name = "num_funl_rspl_regc") private String funcionalResponsavelRegulacao; @Column(name = "txt_ocor_sinr") private String textoOcorrenciaSi; @Column(name = "des_tipo_rela") private String descriptionTipoRelacao; @Column(name = "nom_tipo_rela") private String nomeTipoRelacao; @Column(name = "cod_sexo") private String codeSexo; @Column(name = "cod_tipo_pess") private String codeTipoPessoa; @Column(name = "nom_cpto_usua_prco") private String nomeCompletoUserProtocol; @Column(name = "num_cpf_cnpj_usua_prco") private String numberCpfCnpjUserProtocol; @Column(name = "num_cell_usua_prco") private Integer numberCelularUserProtocol; @Column(name = "num_ende_usua_prco") private Integer numberEnderecoUserProtocol; @Column(name = "cod_ramo_sega") private Integer codeRamoSeguradora; @Column(name = "cod_tipo_rela") private Integer codeTipoRelacao; @Column(name = "cod_cobt") private Integer codeCobertura; @Column(name = "cod_prod_segu") private Integer codeProdutoSeguro; @Column(name = "nom_situ_prco") private String nomeSituacaoProtocol; @Column(name = "nom_situ_sinr") private String nomeSituacaoSi; @Column(name = "txt_decs_anai") private String decisionAnalista; }
follows the Embeddable class:
@Embeddable @Getter @Setter @Builder @EqualsAndHashCode @AllArgsConstructor @NoArgsConstructor public class MovSiPK implements Serializable { @Column(name = "unique_key") private String uniqueKey; @Column(name = "num_prco_sinr", nullable = false) private String numberProtocolSi; @Column(name = "cod_apol_prco") private String codeApoliceProtocol; }
-
Spring boot mapsId
Hi I using spring boot jpa and I need to use mapsid. There are not so much information about that and I wonder if anyone can help me understand how to use maybe link a simple code example where its 2 table that joins 1 table (oneToOne)
-
How to avoid nested for loops in arraylist to retrieve data in Java?
We have POJO classes Employee and Projects. While the Master class has the object of Employee and ArrayList of Projects. We are also creating an Arraylist of Master in Main class where data is assigned and retrieved.
Employee POJO
public class Employee { Integer empID; String name; String desig; public Employee(Integer empID, String name, String desig) { this.empID = empID; this.name = name; this.desig = desig; } @Override public String toString() { return "Employee{" + "empID=" + empID + ", name='" + name + '\'' + ", desig='" + desig + '\'' + '}'; } public Integer getEmpID() { return empID; } public void setEmpID(Integer empID) { this.empID = empID; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesig() { return desig; } public void setDesig(String desig) { this.desig = desig; } }
Project POJO
public class Project { Integer projID; String projName; String location; Integer empID; public Project(Integer projID, String projName, String location, Integer empID) { this.projID = projID; this.projName = projName; this.location = location; this.empID = empID; } public Integer getProjID() { return projID; } public void setProjID(Integer projID) { this.projID = projID; } public String getProjName() { return projName; } public void setProjName(String projName) { this.projName = projName; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public Integer getEmpID() { return empID; } public void setEmpID(Integer empID) { this.empID = empID; } @Override public String toString() { return "Project{" + "projID=" + projID + ", projName='" + projName + '\'' + ", location='" + location + '\'' + ", empID=" + empID + '}'; } }
Master POJO
public class Master { Employee employee; ArrayList<Project> projects; public Employee getEmployee() { return employee; } public void setEmployee(Employee employee) { this.employee = employee; } public ArrayList<Project> getProjects() { return projects; } public void setProjects(ArrayList<Project> projects) { this.projects = projects; } public Master(Employee employee, ArrayList<Project> projects) { this.employee = employee; this.projects = projects; } @Override public String toString() { return "Master{" + "employee=" + employee + ", projects=" + projects + '}'; } }
Main class
public class Main { public static void main(String[] args) { ArrayList<Master> masters = new ArrayList<>(); addData(masters); fetchData(masters); } private static void addData(ArrayList<Master> masters) { // WE ARE INITIALIZING MASTERS IN THIS BLOCK WITH DATA FROM DB } private static void fetchData(ArrayList<Master> masters) { for (int i = 0; i < masters.size(); i++) { System.out.println("Employee "+(i+1)+" "+masters.get(i).getEmployee().getEmpID()+" " +masters.get(i).getEmployee().getName()+" "+masters.get(i).getEmployee().getDesig()); for (int j = 0; j < masters.get(i).getProjects().size(); j++) { System.out.println("Projects "+masters.get(i).getProjects().get(j).getProjID()+" " +masters.get(i).getProjects().get(j).getProjName()+" "+masters.get(i).getProjects().get(j).getLocation() +" "+masters.get(i).getProjects().get(j).getEmpID()); } } } }
How to remove this nested for loop in the fetchData() method in the Main class, to improve the time complexity?
-
I wrote a program for Excel to JSON but it's giving NULL in output. How can I change the code so that it give output instead NULL
The problem with this code is that it's giving NULL in output. How can I print values in output.
Here I created a class ExcelReader in Maven.
public class ExcelReader { public static void main(String[] args) { // TODO Auto-generated method stub try { FileInputStream file = new FileInputStream( new File("C:\\Users\\Ankit Prakash\\Downloads\\BRs automated project creation DRAFT.xlsx")); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(1); Iterator<Row> rowIterator = sheet.rowIterator(); int i=0; while(rowIterator.hasNext()) { Row row = rowIterator.next(); Iterator<Cell> cellIterator = row.cellIterator(); int j=0; while(cellIterator.hasNext()) { Cell cell = cellIterator.next(); "POJO":-Here I created a pojo class and used getter and setters. PojoClassName pcn = new PojoClassName(); // switch(cell.getCellType()) { // case NUMERIC: System.out.println(cell.getNumericCellValue()+"\t"); // break; // case STRING: System.out.println(cell.getStringCellValue()+"\t"); // break; if(i==0) { pcn.setTitle(cell.getStringCellValue()); System.out.println("pcn.toString"); i++; break; } else if(i==1) { pcn.setType(cell.getStringCellValue()); System.out.println("pcn.toString"); i++; break; } else if(i==2) { pcn.setStatus(cell.getStringCellValue()); System.out.println("pcn.toString"); i++; break; } else if(i==3) { pcn.setVersion(cell.getStringCellValue()); System.out.println("cell.getStringCellValue"); i++; break; } else if(i==4) { pcn.setLinkType(cell.getStringCellValue()); System.out.println("cell.getStringCellValue"); i++; break; } else if(i==5) { pcn.ProgrammeName(cell.getStringCellValue()); System.out.println("cell.getStringCellValue"); i++; break; } "Jackson":- here I used object mapper for converting excel to JSON //System.out.println(pcn.toString()); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(pcn); System.out.println(json); } } System.out.println(""); System.out.println("============================================"); // } file.close(); }catch(Exception e) { e.printStackTrace(); System.out.println(); } } }
-
Netbeans macOS keyboard layout language changing to french
Apache Netbeans IDE 12.0 changing my keyboard language to french(Azerty keyboard) when i start coding on the IDE, im using mac os Monterey with swedish keyboard. Anyone can help me to solve this problem?
-
Nbeans cant find or load main class
Hello good day this is the first object oriented class, and I throw this error? How do I fix it? Thank you. ERROR --------------------------------[ jar ]---------------------------------
--- exec-maven-plugin:3.0.0:exec (default-cli) @ Suma2 --- Error: Could not find or load main class com.mycompany.suma2.suma.SumaMain Caused by: java.lang.ClassNotFoundException: com.mycompany.suma2.suma.SumaMain Command execution failed.
There are two codes, here is one
package com.mycompany.suma2.suma; public class SumaMain { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Give me the first value "); int valueOne=sc.nextInt(); System.out.println("Give me the first value"); int valueTwo = sc.nextInt() ; Sum values = new Sum(valueOne, valueTwo){ values.Print(); } }
Here the other
public class Sum { private int vOne, vTwo, Result ; public Sum (int valueOne , int valueTwo ) { this.vOne = valueOne ; this.VTwo = valueTwo ; } public void Operation(){ Result = vOne +vTwo ; } public void Print(){ Operation(); System.out.println("The result of the sum is : + Result "); } }
-
ubuntu 22.04 xrdp could not start log
trying to start xrdp with
sudo systemctl start xrdp
fails with error:
could not start log
What is missing?
-
Ubuntu dual boot stuck after choosing try and install Ubuntu option
Stuck at load screen, loading circle also freezes. https://i.stack.imgur.com/8icTP.jpg
-
How to make xcape work again on Ubuntu 22.04
I'm a vim/nvim user, and xcape has become for me a key feature in the last years.
I use it in combination with gnome-tweaks (new package name, on previous version was gnome-tweak-tool) in oder to:- use
CapsLock
as aCtrl
in cobination with another key - use
CapsLock
as anEsc
when i use it alone.
The xcape command that I use is:
xcape -e 'Caps_Lock=Escape'
this command is not working anymore as expected on Ubuntu 22.04.
When I run
xcape -d
I noticed that:- Ubuntu 20.04 every key event is intercepted no matter in which windows i am.
- Ubuntu 22.04 key event from teminal/Text editor/Files is not intercepted, but when i'm on Chrome they are.
Does anyone knows the reason of this behaviour? It is very annoying!
Thank you in advance for the help!
- use
-
Hibernate not showing in frameworks section in Netbeans 13
I'm trying to create a Java web application using Hibernate framework in Netbeans 13 IDE. All the youtube videos and blogs that I've seen seem to have Hibernate in frameworks section. But in Netbeans 13 it is not there
All the solutions that I've read are for older versions of Netbeans and not working for version 13. Is there a way to get Hibernate in Frameworks in Netbeans 13 without having to add Jar files manually each time.
-
Can't acces to run settings in project :Simple Javafx maven archetype(gluon) in netbeans 13
I'm trying to change vm options in netbeans 13 and I can't change anything at Run setup. At the bottom of the run settings throws a warning : One of Run/Debug/Profile Project actions has been modified and the Run panel cannot be safely edited. Almost everything else works fine : javafx apps can be compiled and run . autocompletion in java works fine in javafx libraries .
openjfx version 17.0.2
javafx maven plugin version 0.0.8
jdk coretto 17 in ubuntu 20.4 64
gluon plugin 2.8.4 on netbeans 13
pom file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com</groupId> <artifactId>mavenproject7</artifactId> <version>1.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-controls</artifactId> <version>17.0.2</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <release>11</release> </configuration> </plugin> <plugin> <groupId>org.openjfx</groupId> <artifactId>javafx-maven-plugin</artifactId> <version>0.0.8</version> <configuration> <mainClass>com.mavenproject7.App</mainClass> </configuration> <executions> <execution> <!-- Default configuration for running --> <!-- Usage: mvn clean javafx:run --> <id>default-cli</id> </execution> </executions> </plugin> </plugins> </build> </project>
-
"Unable to create javax script engine for javascript" error when trying to create EXE file
I've came across this problem while trying to generate .exe file by using Netbeans 13. (Package as -> exe installer)
Full error:
C:\Users\*\Documents\NetBeansProjects\*\nbproject\build-native.xml:428: The following error occurred while executing this line: C:\Users\*\Documents\NetBeansProjects\*\nbproject\build-native.xml:436: Unable to create javax script engine for javascript BUILD FAILED (total time: 4 seconds)
Does anyone know what seems to be problem here and how to fix it?
UPDATE:
OS: Windows 10
JavaFX: javafx-sdk-17.0.2
JDK: jdk-17.0.2
What am I expecting?
- I am expecting .exe file
There's no need really for posting code because building project and running project itself goes smoothly (without the errors). The problem occurs after trying to generate .exe installer file by using Package As -> EXE Installer (as shown in image):
You can go back to see Full error and when I open build-native.xml file it points me to these lines of code:
<target name="-jfx-copylibs" depends="init,compile,-pre-pre-jar,-pre-jar,-jfx-copylibs-warning" unless="fallback.no.javascript"> <jfx-copylibs-js-impl/> </target> <target name="-jfx-copylibs-warning" if="fallback.no.javascript"> <echo message="Warning: Dependent Libraries copy (-jfx-copylibs) skipped in fallback build mode due to JDK missing JavaScript support."/> </target> <macrodef name="jfx-copylibs-js-impl"> <sequential> <local name="run.classpath.without.build.classes.and.dist.dir"/> <pathconvert property="run.classpath.without.build.classes.and.dist.dir"> <path path="${run.classpath}"/> <map from="${basedir}${file.separator}${build.classes.dir}" to=""/> <map from="${basedir}${file.separator}${dist.jar}" to=""/> <scriptmapper language="javascript">
Where line 428 is:
<target name="-jfx-copylibs" depends="init,compile,-pre-pre-jar,-pre-jar,-jfx-copylibs-warning" unless="fallback.no.javascript"> <jfx-copylibs-js-impl/>
And where line 436 is:
<pathconvert property="run.classpath.without.build.classes.and.dist.dir">