style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-5164839828746352"
data-ad-slot="7563230308">

Ayuda! Capturar BigDecimal por Jtextfield

No se como capturar el valor del salario que es BigDecimal por el jtextfield, podrian ayudarme

Empleado empleado= new Empleado(Integer.parseInt(codigotxt.getText()) , nombrestxt.getText(), apellidostxt.getText(),
                            emailtxt.getText(),telefonotxt.getText(), ingresodate.getDate(),
                            jobitxt.getText(), BigDecimal.valueOf(Double.parseDouble(salariotxt.getText())),
                            Integer.parseInt(comisiontxt.getText()),
                            Integer.parseInt(jefeidtxt.getText()), Integer.parseInt(departamentoidtxt.getText()));
        oper.altaempleados(empleado);

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.

BigDecimal: Simplemente...

 

No necesitas convertir a double. Simplemente:

new BigDecimal(salariotxt.getText())

p.ej.:

import java.math.BigDecimal;

import javax.swing.JOptionPane;
import javax.swing.JTextField;

public class Main {
    public static void main(String[] args) {
        JTextField salariotxt = new JTextField();
        JOptionPane.showMessageDialog(null, salariotxt);
        BigDecimal salario = new BigDecimal(salariotxt.getText());
        System.out.println(salario);
    }
}

Opcionalmente, puedes truncar a 2 decimales.

new BigDecimal(salariotxt.getText(), new MathContext(2, RoundingMode.FLOOR))

~~~

Conectado BD Oracle

Estoy usando una conexion a la base de datos con Hibernate

esta es la parte es que no he podido solucionar el inconveniente

 Employees empleado = new Employees(Integer.parseInt(codigotxt.getText()) , nombrestxt.getText(), apellidostxt.getText(),
                            emailtxt.getText(),telefonotxt.getText(), ingresodate.getDate(),
                            Integer.parseInt(jobidtxt.getText()),
                            BigDecimal.valueOf(Double.parseDouble(salariotxt.getText())),
                            BigDecimal.valueOf(Double.parseDouble(comisiontxt.getText())),
                            Integer.parseInt(jefeidtxt.getText()), Integer.parseInt(departamentoidtxt.getText()));
        oper.altaempleados(empleado);

Clase Alta_Empleados

package vista;

import controlador.Operaciones;
import java.math.BigDecimal;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import modelo.*;

public class Alta_Empleados extends javax.swing.JFrame {
    Operaciones oper;
    /**
     * Creates new form Alta_Empleados
     */

    public Alta_Empleados() {
        initComponents();
        oper = new Operaciones();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        codigotxt = new javax.swing.JTextField();
        apellidostxt = new javax.swing.JTextField();
        nombrestxt = new javax.swing.JTextField();
        emailtxt = new javax.swing.JTextField();
        telefonotxt = new javax.swing.JTextField();
        jobidtxt = new javax.swing.JTextField();
        salariotxt = new javax.swing.JTextField();
        jefeidtxt = new javax.swing.JTextField();
        departamentoidtxt = new javax.swing.JTextField();
        ingresodate = new com.toedter.calendar.JDateChooser();
        jButton1 = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        comisiontxt = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("Nombres:");

        jLabel2.setText("Apellidos:");

        jLabel3.setText("Email:");

        jLabel4.setText("Telefono:");

        jLabel5.setText("Fecha Ingreso:");

        jLabel6.setText("Codigo de Trabajo:");

        jLabel7.setText("Salario:");

        jLabel8.setText("Codigo Supervisor:");

        jLabel9.setText("Codigo de Departamento:");

        jLabel10.setText("Codigo:");

        codigotxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                codigotxtActionPerformed(evt);
            }
        });

        apellidostxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                apellidostxtActionPerformed(evt);
            }
        });

        nombrestxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nombrestxtActionPerformed(evt);
            }
        });

        emailtxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                emailtxtActionPerformed(evt);
            }
        });

        telefonotxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                telefonotxtActionPerformed(evt);
            }
        });

        jobidtxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jobidtxtActionPerformed(evt);
            }
        });

        salariotxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salariotxtActionPerformed(evt);
            }
        });

        jefeidtxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jefeidtxtActionPerformed(evt);
            }
        });

        departamentoidtxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                departamentoidtxtActionPerformed(evt);
            }
        });

        jButton1.setText("Aceptar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel11.setText("Comision:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel11)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(60, 60, 60)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel10)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel1)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel8))))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel9)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(codigotxt)
                    .addComponent(apellidostxt, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addComponent(nombrestxt, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addComponent(emailtxt, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addComponent(telefonotxt, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addComponent(jobidtxt, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addComponent(salariotxt, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addComponent(jefeidtxt, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addComponent(departamentoidtxt, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addComponent(ingresodate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(comisiontxt))
                .addGap(69, 69, 69)
                .addComponent(jButton1)
                .addContainerGap(89, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(codigotxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(nombrestxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(6, 6, 6))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(1, 1, 1)
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(apellidostxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(emailtxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(telefonotxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(ingresodate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jobidtxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(salariotxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(comisiontxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jefeidtxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(4, 4, 4)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(departamentoidtxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>                        

    private void codigotxtActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                        

    private void apellidostxtActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
    }                                            

    private void nombrestxtActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                          

    private void emailtxtActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
    }                                        

    private void telefonotxtActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
    }                                          

    private void jobidtxtActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
    }                                        

    private void salariotxtActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                          

    private void jefeidtxtActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                        

    private void departamentoidtxtActionPerformed(java.awt.event.ActionEvent evt) {                                                  
        // TODO add your handling code here:
    }                                                

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here
        Employees empleado = new Employees(Integer.parseInt(codigotxt.getText()) , nombrestxt.getText(), apellidostxt.getText(),
                            emailtxt.getText(),telefonotxt.getText(), ingresodate.getDate(),
                            Integer.parseInt(jobidtxt.getText()),
                            BigDecimal.valueOf(Double.parseDouble(salariotxt.getText())),
                            BigDecimal.valueOf(Double.parseDouble(comisiontxt.getText())),
                            Integer.parseInt(jefeidtxt.getText()), Integer.parseInt(departamentoidtxt.getText()));
        oper.altaempleados(empleado);
    }                                        

    /**
     * @param args the command line arguments
     */

    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see <a href="http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html" title="http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html">http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html</a>
         */

        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Alta_Empleados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Alta_Empleados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Alta_Empleados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Alta_Empleados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Alta_Empleados().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                    
    private javax.swing.JTextField apellidostxt;
    private javax.swing.JTextField codigotxt;
    private javax.swing.JTextField comisiontxt;
    private javax.swing.JTextField departamentoidtxt;
    private javax.swing.JTextField emailtxt;
    private com.toedter.calendar.JDateChooser ingresodate;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jefeidtxt;
    private javax.swing.JTextField jobidtxt;
    private javax.swing.JTextField nombrestxt;
    private javax.swing.JTextField salariotxt;
    private javax.swing.JTextField telefonotxt;
    // End of variables declaration                  
}

Clase Operaciones

package controlador;

import java.math.BigDecimal;
import java.util.Iterator;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import modelo.*;

public class Operaciones {
   
    public void altaempleados(Employees empleado){
       
        SessionFactory sesion = NewHibernateUtil.getSessionFactory();
        Session session;
        session = sesion.openSession();
        Transaction tx = session.beginTransaction();
        session.save(empleado);
        tx.commit();
        session.close();
        JOptionPane.showMessageDialog(null,"Empleado Insertado.");
   
}
   
}

Clase Departamento

package modelo;

import java.util.HashSet;
import java.util.Set;

/**
 * Departments generated by hbm2java
 */

public class Departments  implements java.io.Serializable {

     private short departmentId;
     private Employees employees;
     private String departmentName;
     private Short locationId;
     private Set employeeses = new HashSet(0);

    public Departments() {
    }

       
    public Departments(short departmentId, String departmentName) {
        this.departmentId = departmentId;
        this.departmentName = departmentName;
    }
    public Departments(short departmentId, Employees employees, String departmentName, Short locationId, Set employeeses) {
       this.departmentId = departmentId;
       this.employees = employees;
       this.departmentName = departmentName;
       this.locationId = locationId;
       this.employeeses = employeeses;
    }
   
    public short getDepartmentId() {
        return this.departmentId;
    }
   
    public void setDepartmentId(short departmentId) {
        this.departmentId = departmentId;
    }
    public Employees getEmployees() {
        return this.employees;
    }
   
    public void setEmployees(Employees employees) {
        this.employees = employees;
    }
    public String getDepartmentName() {
        return this.departmentName;
    }
   
    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }
    public Short getLocationId() {
        return this.locationId;
    }
   
    public void setLocationId(Short locationId) {
        this.locationId = locationId;
    }
    public Set getEmployeeses() {
        return this.employeeses;
    }
   
    public void setEmployeeses(Set employeeses) {
        this.employeeses = employeeses;
    }

}

Clase Employees

package modelo;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * Employees generated by hbm2java
 */

public class Employees  implements java.io.Serializable {

     private int employeeId;
     private Employees employees;
     private Jobs jobs;
     private Departments departments;
     private String firstName;
     private String lastName;
     private String email;
     private String phoneNumber;
     private Date hireDate;
     private BigDecimal salary;
     private BigDecimal commissionPct;
     private Set employeeses = new HashSet(0);
     private Set departmentses = new HashSet(0);

    public Employees() {
    }

       
    public Employees(int employeeId, Jobs jobs, String lastName, String email, Date hireDate) {
        this.employeeId = employeeId;
        this.jobs = jobs;
        this.lastName = lastName;
        this.email = email;
        this.hireDate = hireDate;
    }
    public Employees(int employeeId, Employees employees, Jobs jobs, Departments departments, String firstName, String lastName, String email, String phoneNumber, Date hireDate, BigDecimal salary, BigDecimal commissionPct, Set employeeses, Set departmentses) {
       this.employeeId = employeeId;
       this.employees = employees;
       this.jobs = jobs;
       this.departments = departments;
       this.firstName = firstName;
       this.lastName = lastName;
       this.email = email;
       this.phoneNumber = phoneNumber;
       this.hireDate = hireDate;
       this.salary = salary;
       this.commissionPct = commissionPct;
       this.employeeses = employeeses;
       this.departmentses = departmentses;
    }

    public Employees(int employeeId, String firstName, String lastName, String email, String phoneNumber, Date hireDate, BigDecimal salary, Jobs jobs, BigDecimal commissionPct, Employees employees, Departments departments) {
        this.employeeId = employeeId;
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.phoneNumber = phoneNumber;
        this.hireDate = hireDate;
        this.jobs = jobs;
        this.salary = salary;
        this.commissionPct = commissionPct;
        this.employees = employees;
        this.departments = departments;  
    }

   
    public int getEmployeeId() {
        return this.employeeId;
    }
   
    public void setEmployeeId(int employeeId) {
        this.employeeId = employeeId;
    }
    public Employees getEmployees() {
        return this.employees;
    }
   
    public void setEmployees(Employees employees) {
        this.employees = employees;
    }
    public Jobs getJobs() {
        return this.jobs;
    }
   
    public void setJobs(Jobs jobs) {
        this.jobs = jobs;
    }
    public Departments getDepartments() {
        return this.departments;
    }
   
    public void setDepartments(Departments departments) {
        this.departments = departments;
    }
    public String getFirstName() {
        return this.firstName;
    }
   
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public String getLastName() {
        return this.lastName;
    }
   
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    public String getEmail() {
        return this.email;
    }
   
    public void setEmail(String email) {
        this.email = email;
    }
    public String getPhoneNumber() {
        return this.phoneNumber;
    }
   
    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }
    public Date getHireDate() {
        return this.hireDate;
    }
   
    public void setHireDate(Date hireDate) {
        this.hireDate = hireDate;
    }
    public BigDecimal getSalary() {
        return this.salary;
    }
   
    public void setSalary(BigDecimal salary) {
        this.salary = salary;
    }
    public BigDecimal getCommissionPct() {
        return this.commissionPct;
    }
   
    public void setCommissionPct(BigDecimal commissionPct) {
        this.commissionPct = commissionPct;
    }
    public Set getEmployeeses() {
        return this.employeeses;
    }
   
    public void setEmployeeses(Set employeeses) {
        this.employeeses = employeeses;
    }
    public Set getDepartmentses() {
        return this.departmentses;
    }
   
    public void setDepartmentses(Set departmentses) {
        this.departmentses = departmentses;
    }

}

Clase Jobs

package modelo;

import java.util.HashSet;
import java.util.Set;

/**
 * Jobs generated by hbm2java
 */

public class Jobs  implements java.io.Serializable {

     private String jobId;
     private String jobTitle;
     private Integer minSalary;
     private Integer maxSalary;
     private Set employeeses = new HashSet(0);

    public Jobs() {
    }

       
    public Jobs(String jobId, String jobTitle) {
        this.jobId = jobId;
        this.jobTitle = jobTitle;
    }
    public Jobs(String jobId, String jobTitle, Integer minSalary, Integer maxSalary, Set employeeses) {
       this.jobId = jobId;
       this.jobTitle = jobTitle;
       this.minSalary = minSalary;
       this.maxSalary = maxSalary;
       this.employeeses = employeeses;
    }
   
    public String getJobId() {
        return this.jobId;
    }
   
    public void setJobId(String jobId) {
        this.jobId = jobId;
    }
    public String getJobTitle() {
        return this.jobTitle;
    }
   
    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }
    public Integer getMinSalary() {
        return this.minSalary;
    }
   
    public void setMinSalary(Integer minSalary) {
        this.minSalary = minSalary;
    }
    public Integer getMaxSalary() {
        return this.maxSalary;
    }
   
    public void setMaxSalary(Integer maxSalary) {
        this.maxSalary = maxSalary;
    }
    public Set getEmployeeses() {
        return this.employeeses;
    }
   
    public void setEmployeeses(Set employeeses) {
        this.employeeses = employeeses;
    }

}

Clase Agenda_Hibernate

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package agenda_hibernate;

public class Agenda_hibernate {

    /**
     * @param args the command line arguments
     */

    public static void main(String[] args) {
        // TODO code application logic here
        new vista.Alta_Empleados().setVisible(true);
    }
   
}

Manual de Hibernate

 

Visita la siguiente página: HIBERNATE - Persistencia relacional para Java idiomático (en español). El Capítulo 22. Ejemplo: Padre/Hijo puede iluminarte un poco para solucionar el problema que tienes entre manos.

Si vas a utilizar Hibernate, lo mejor es que te familiarices con este. Adicionalmente, hay muchos videos en YouTube sobre cómo usar Hibernate. Google es tu mejor amigo.

~~~

Donde

Donde dice:

 BigDecimal.valueOf(Double.parseDouble(salariotxt.getText())),

cambialo por

new  BigDecimal(salariotxt.getText()),

Es lo que te dijo jpaul inicialmente, que uses Oracle o Hibernate no tiene nada que ver.

hi

no me ha funcionado de esa forma

style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-5164839828746352"
data-ad-slot="7563230308">