Search Results

Search found 1393 results on 56 pages for 'employee'.

Page 5/56 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Inaccessible item using C++ inheritance

    - by shinjuo
    I am working on C++ project that uses inheritance. I seem to have an error in visual studio in the below file administrator.h. It says that salariedemploye:salary on line 17 is inaccessible and I am not sure why. Admin.cpp #include namespace SavitchEmployees { Administrator::Administrator( ):SalariedEmployee(), salary(0) { //deliberately empty } Administrator::Administrator(const string& theName, const string& theSsn, double theAnnualSalary) :SalariedEmployee(theName, theSsn),salary(theAnnualSalary) { //deliberately empty } void Administrator::inputAdminData() { cout << " Enter the details of the administrator " << getName() << endl; cout << " Enter the admin title" << endl; getline(cin, adminTitle); cout << " Enter the area of responsibility " << endl; getline(cin, workingArea); cout << " Enter the immediate supervisor's name " << endl; getline(cin, supervisorName); } void Administrator::outputAdminData() { cout << "Name: " << getName() << endl; cout << "Title: " << adminTitle << endl; cout << "Area of responsibility: " << workingArea << endl; cout << "Immediate supervisor: " << supervisorName << endl; } void Administrator::printCheck() { setNetPay(salary); cout << "\n___________________________________\n" << "Pay to the order of " << getName() << endl << "The sum of" << getNetPay() << "Dollars\n" << "______________________________________\n" << "Check Stub Not negotiable \n" << "Employee Number: " << getSsn() << endl << "Salaried Employee(Administrator). Regular Pay: " << salary << endl << "______________________________________\n"; } } admin.h #include <iostream> #include "salariedemployee.h" using std::endl; using std::string; namespace SavitchEmployees { class Administrator : public SalariedEmployee { public: Administrator(); Administrator(const string& theName, const string& theSsn, double salary); double getSalary() const; void inputAdminData(); void outputAdminData(); void printCheck(); private: string adminTitle;//administrator's title string workingArea;//area of responsibility string supervisorName;//immediate supervisor }; } #endif SalariedEmployee.cpp namespace SavitchEmployees { SalariedEmployee::SalariedEmployee():Employee(),salary(0) { //deliberately empty } SalariedEmployee::SalariedEmployee(const string& theName, const string& theNumber, double theWeeklyPay) :Employee(theName, theNumber), salary(theWeeklyPay) { //deliberately empty } double SalariedEmployee::getSalary() const { return salary; } void SalariedEmployee::setSalary(double newSalary) { salary = newSalary; } void SalariedEmployee::printCheck() { setNetPay(salary); cout << "\n___________________________________\n" << "Pay to the order of " << getName() << endl << "The sum of" << getNetPay() << "Dollars\n" << "______________________________________\n" << "Check Stub NOT NEGOTIABLE \n" << "Employee Number: " << getSsn() << endl << "Salaried Employee. Regular Pay: " << salary << endl << "______________________________________\n"; } } Salariedemplyee.h #ifndef SALARIEDEMPLOYEE_H #define SALARIEDEMPLOYEE_H #include <string> #include "employee.h" namespace SavitchEmployees{ class SalariedEmployee : public Employee{ public: SalariedEmployee(); SalariedEmployee(const string& theName, const string& theSsn, double theWeeklySalary); double getSalary() const; void setSalary(double newSalary); void printCheck(); private: double salary; }; } #endif employee.cpp namespace SavitchEmployees { Employee::Employee():name("No name yet"),ssn("No number yet"),netPay(0){} Employee::Employee(const string& theName, const string& theSsn):name(theName),ssn(theSsn),netPay(0){} string Employee::getName() const { return name; } string Employee::getSsn() const { return ssn; } double Employee::getNetPay() const { return netPay; } void Employee::setName(const string& newName) { name = newName; } void Employee::setSsn(const string& newSsn) { ssn = newSsn; } void Employee::setNetPay(double newNetPay) { netPay = newNetPay; } void Employee::printCheck() const { cout << "\nERROR: pringCheck function called for an \n" << "Undifferentiated employee. Aborting the program!\n" << "Check with the author of this program about thos bug. \n"; exit(1); } }

    Read the article

  • [LINQ] Master&ndash;Detail Same Record (I)

    - by JTorrecilla
    PROBLEM Firstly, I am working on a project based on LINQ, EF, and C# with VS2010. The following Table shows what I have and what I want to show. Header C1 C2 C3 1 P1 01/01/2011 2 P2 01/02/2011 Details 1 1 D1 2 1 D2 3 1 D3 4 2 D1 5 2 D4 Expected Results 1 P1 01/01/2011 D1, D2, D3 2 P2 01/02/2011 D1,D4   IDEAS At the begin I got 3 possible ways: - Doing inside the DB:  It could be achieved from DB with a CURSOR in a Stored Procedure. - Doing from .NET with LOOPS. - Doing with LINQ (I love it!!) FIRST APROX Example with a simple CLASS with a LIST: With and Employee Class that acts as Header Table: 1: public class Employee 2: { 3: public Employee () { } 4: public Int32 ID { get; set; } 5: public String FirstName{ get; set; } 6: public String LastName{ get; set; } 7: public List<string> Numbers{ get; set; } // Acts as Details Table 8: } We can show all numbers contained by Employee: 1: List<Employee > listado = new List<Employee >(); 2: //Fill Listado 3: var query= from Employee em in listado 4: let Nums= string.Join(";", em.Numbers) 5: select new { 6: em.Name, 7: Nums 8: }; The “LET” operator allows us to host the results of “Join” of the Numbers List of the Employee Class. A little example. ASAP I will post the second part to achieve the same with Entity Framework. Best Regards

    Read the article

  • Who owns the IP rights of the software without written employment contract? Employer or employee? [closed]

    - by P T
    I am a software engineer who got an idea, and developed alone an integrated ERP software solution over the past 2 years. I got the idea and coded much of the software in my personal time, utilizing my own resources, but also as intern/employee at small wholesale retailer (company A). I had a verbal agreement with the company that I could keep the IP rights to the code and the company would have the "shop rights" to use "a copy" of the software without restrictions. Part of this agreement was that I was heavily underpaid to keep the rights. Recently things started to take a down turn in the company A as the company grew fairly large and new head management was formed, also new partners were brought in. The original owners distanced themselves from the business, and the new "greedy" group indicated that they want to claim the IP rights to my software, offering me a contract that would split the IP ownership into 50% co-ownership, completely disregarding the initial verbal agreements. As of now there was no single written job description and agreement/contract/policy that I signed with the company A, I signed only I-9 and W-4 forms. I now have an opportunity to leave the company A and form a new business with 2 partners (Company B), obviously using the software as the primary tool. There would be no direct conflict of interest as the company A sells wholesale goods. My core question is: "Who owns the code without contract? Me or the company A? (in FL, US)" Detailed questions: I am familiar with the "shop rights", I don't have any problem leaving a copy of the code in the company for them to use/enhance to run their wholesale business. What worries me, Can the company A make any legal claims to the software/code/IP and potential derived profits/interests after I leave and form a company B? Can applying for a copyright of the code at http://www.copyright.gov in my name prevent any legal disputes in the future? Can I use it as evidence for legal defense? Could adding a note specifying the company A as exclusive license holder clarify the arrangements? If I leave and the company A sues me, what evidence would they use against me? On what basis would the sue since their business is in completely different industry than software (wholesale goods). Every single source file was created/stored on my personal computer with proper documentation including a copyright notice with my credentials (name/email/addres/phone). It's also worth noting that I develop significant part of the software prior to my involvement with the company A as student. If I am forced to sign a contract and the company A doesn't honor the verbal agreement, making claims towards the ownership, what can I do settle the matter legally? I like to avoid legal process altogether as my budget for court battles is extremely limited at the moment. Would altering the code beyond recognition and using it for the company B prevent the company A make any copyright claims? My common sense tells me that what I developed is by default mine in terms of IP, unless there is a signed legal agreement stating otherwise. But looking online it may be completely backwards, this really worries me. I understand that this is not legal advice, and I know to get the ultimate answer I need to hire a lawyer. I am only hoping to get some valuable input/experience/advice/opinion from those who were in similar situation or are familiar with the topic. Thank you, PT

    Read the article

  • linq to sql update data

    - by pranay
    can i update my employee record as given in below function or i have to make query of employee collection first and than i update data public int updateEmployee(App3_EMPLOYEE employee) { DBContextDataContext db = new DBContextDataContext(); db.App3_EMPLOYEEs.Attach(employee); db.SubmitChanges(); return employee.PKEY; } or i have to do this public int updateEmployee(App3_EMPLOYEE employee) { DBContextDataContext db = new DBContextDataContext(); App3_EMPLOYEE emp = db.App3_EMPLOYEEs.Single(e => e.PKEY == employee.PKEY); db.App3_EMPLOYEEs.Attach(employee,emp); db.SubmitChanges(); return employee.PKEY; } But i dont want to use second option is there any efficient way to update data

    Read the article

  • Build comma seperated string from the struct in C#

    - by acadia
    Hello, I have the following struct in C# class public struct Employee { public const string EMPID = "EMP_ID"; public const string FName = "FIRST_NAME"; public const string LNAME = "LAST_NAME"; public const string DEPTID = "DEPT_ID"; } Is there an easy way to build a string as follows const string mainquery="INSERT INTO EMP(EMP_ID,FIRST_NAME,LAST_NAME,DEPT_ID) VALUES(:EMP_ID,:FIRST_NAME,:LAST_NAME,:DEPT_ID)" Instead of doing as follows and then concatenating it. const string EMP_COLS= EMPLOYEE.EMPID + "," + EMPLOYEE.FNAME + "," + EMPLOYEE.LNAME + "," + EMPLOYEE.DEPTID; const string EMP_Values= EMPLOYEE.EMPID + ":" + EMPLOYEE.FNAME + ":" + EMPLOYEE.LNAME + ":" + EMPLOYEE.DEPTID;

    Read the article

  • Most efficient way to Update with Linq2Sql

    - by pranay
    can I update my employee record as given in below function or i have to make query of employee collection first and than i update data public int updateEmployee(App3_EMPLOYEE employee) { DBContextDataContext db = new DBContextDataContext(); db.App3_EMPLOYEEs.Attach(employee); db.SubmitChanges(); return employee.PKEY; } or i have to do this public int updateEmployee(App3_EMPLOYEE employee) { DBContextDataContext db = new DBContextDataContext(); App3_EMPLOYEE emp = db.App3_EMPLOYEEs.Single(e => e.PKEY == employee.PKEY); db.App3_EMPLOYEEs.Attach(employee,emp); db.SubmitChanges(); return employee.PKEY; } But i dont want to use second option is there any efficient way to update data

    Read the article

  • Extract 2 numbers preceded with two different strings in a paragrapf using TCL Regular Expression

    - by Madhu
    Hi, I need to extract two different numbers preceded by two different strings. Employee Id-- Employee16(I need 16) and Employee links-- Employee links:2 (I need 2). Source String looks like following: Employee16, Employee name is QueenRose Working for 46w0d Billing is Distributed 65537 assigned tasks, 0 reordered, 0 unassigned 0 discarded, 0 lost received, 5/255 load received sequence unavailable, 0xC2E7 sent sequence Employee links: 2 active, 0 inactive (max not set, min not set) Dt3/5/10:0, since 46w0d, no tasks pending Dt3/5/10:10, since 21w0d, no tasks rcvd Employee is currently working in Hardware section. Employee19, Employee name is Edward11 Working for 48w4d Billing is Distributed 206801498 assigned tasks, 0 reordered, 0 unassigned 655372 discarded, 0 lost received, 9/255 load received sequence unavailable, 0x23CA sent sequence Employee links: 7 active, 0 inactive (max not set, min not set) Dt3/5/10:0, since 47w2d, tasks pending Dt3/5/10:10, since 28w6d, no tasks pending Dt3/5/10:11, since 18w4d, no tasks pending Dt3/5/10:12, since 18w4d, no tasks pending Dt3/5/10:13, since 18w4d, no tasks pending Dt3/5/10:14, since 18w4d, no tasks pending Dt3/5/10:15, since 7w2d, no tasks pending Employee is currently working in Hardware sectione. Employee6 (inactive) Employee links: 2 Dt3/5/10:0 (inactive) Dt3/5/10:10 (inactive) Employee7 (inactive) Employee links: 2 Dt3/5/10:0 (inactive) Dt3/5/10:10 (inactive) Tried with the following: Multilink(\d+)[^\n\r]*[^M]*Member links:\s+(\d+) But is not listing all the Ids and links. Can anybody help me getting this? Thanks in advance, Madhu.

    Read the article

  • Entity Framework: Auto-updating foreign key when setting a new object reference

    - by Adrian Grigore
    Hi, I am porting an existing application from Linq to SQL to Entity Framework 4 (default code generation). One difference I noticed between the two is that a foreign key property are not updated when resetting the object reference. Now I need to decide how to deal with this. For example supposing you have two entity types, Company and Employee. One Company has many Employees. In Linq To SQL, setting the company also sets the company id: var company=new Company(ID=1); var employee=new Employee(); Debug.Assert(employee.CompanyID==0); employee.Company=company; Debug.Assert(employee.CompanyID==1); //Works fine! In Entity Framework (and without using any code template customization) this does not work: var company=new Company(ID=1); var employee=new Employee(); Debug.Assert(employee.CompanyID==0); employee.Company=company; Debug.Assert(employee.CompanyID==1); //Throws, since CompanyID was not updated! How can I make EF behave the same way as LinqToSQL? I had a look at the default code generation T4 template, but I could not figure out how to make the necessary changes.

    Read the article

  • Cant we use a Set or collection as a return type in GAE?

    - by user273422
    In my code i have used Set<Employees> as a return type to my function addEmp(). So, i m gettin an Compilation error. The Error is: Compiling module com.employeedepartmentgae.Employeedepartmentgae Refreshing module from source Validating newly compiled units Removing units with errors [ERROR] Errors in 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingServiceAsync.java' [ERROR] Line 6: The import com.employeedepartmentgae.server.domainobject.Employee cannot be resolved [ERROR] Line 18: Employee cannot be resolved to a type [ERROR] Errors in 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingService.java' [ERROR] Line 6: The import com.employeedepartmentgae.server.domainobject.Employee cannot be resolved [ERROR] Line 20: Employee cannot be resolved to a type [ERROR] Errors in 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/EmployeeWidget.java' [ERROR] Line 12: The import com.employeedepartmentgae.server.domainobject.Employee cannot be resolved [ERROR] Line 75: The method addEmp(String, String, String, AsyncCallback) from the type GreetingServiceAsync refers to the missing type Employee [ERROR] Line 75: The type new AsyncCallback(){} must implement the inherited abstract method AsyncCallback.onSuccess(Set) [ERROR] Line 75: Employee cannot be resolved to a type [ERROR] Line 94: The method onSuccess(Set) of type new AsyncCallback(){} must override or implement a supertype method [ERROR] Line 94: Employee cannot be resolved to a type [ERROR] Line 96: Employee cannot be resolved to a type [ERROR] Line 96: Employee cannot be resolved to a type [ERROR] Line 98: Employee cannot be resolved to a type Removing invalidated units [WARN] Compilation unit 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/Employeedepartmentgae.java' is removed due to invalid reference(s): [WARN] file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/EmployeeWidget.java [WARN] Compilation unit 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/DepartmentWidget.java' is removed due to invalid reference(s): [WARN] file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingService.java [WARN] file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingServiceAsync.java Computing all possible rebind results for 'com.employeedepartmentgae.client.Employeedepartmentgae' Rebinding com.employeedepartmentgae.client.Employeedepartmentgae Checking rule [ERROR] Unable to find type 'com.employeedepartmentgae.client.Employeedepartmentgae' [ERROR] Hint: Previous compiler errors may have made this type unavailable [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly So please help me.....

    Read the article

  • How to Object Array to List

    - by Peter Black
    (C#) I have 2 classes. 1 is called Employee. The other is my "main". I am trying to take a list and assign each value in list to an array of Employee object. //Inside "Main" class int counter = NameList.Count; Employee[] employee = new Employee[counter]; for (int i = 0; i <= counter; i++) { employee[i].Name = NameList[i]; employee[i].EmpNumber = EmpNumList[i]; employee[i].DateOfHire = DOHList[i]; employee[i].Salary = SalaryList[i]; employee[i].JobDescription = JobDescList[i]; employee[i].Department = DeptList[i]; } This returns the error: An unhandled exception of type 'System.NullReferenceException' occurred in Pgm4.exe Additional information: Object reference not set to an instance of an object. I think this means that I am not calling the list properly. Any help would be much appreciated. Thank you.

    Read the article

  • Can't get running JPA2 with Hibernate and Maven

    - by erlord
    Have been trying the whole day long and googled the ** out of the web ... in vain. You are my last hope: Here's my code: The Entity: package sas.test.model; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Employee { @Id private int id; private String name; private long salary; public Employee() {} public Employee(int id) { this.id = id; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getSalary() { return salary; } public void setSalary (long salary) { this.salary = salary; } } The service class: package sas.test.dao; import sas.test.model.Employee; import javax.persistence.*; import java.util.List; public class EmployeeService { protected EntityManager em; public EmployeeService(EntityManager em) { this.em = em; } public Employee createEmployee(int id, String name, long salary) { Employee emp = new Employee(id); emp.setName(name); emp.setSalary(salary); em.persist(emp); return emp; } public void removeEmployee(int id) { Employee emp = findEmployee(id); if (emp != null) { em.remove(emp); } } public Employee raiseEmployeeSalary(int id, long raise) { Employee emp = em.find(Employee.class, id); if (emp != null) { emp.setSalary(emp.getSalary() + raise); } return emp; } public Employee findEmployee(int id) { return em.find(Employee.class, id); } } And the main class: package sas.test.main; import javax.persistence.*; import java.util.List; import sas.test.model.Employee; import sas.test.dao.EmployeeService; public class ExecuteMe { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("EmployeeService"); EntityManager em = emf.createEntityManager(); EmployeeService service = new EmployeeService(em); // create and persist an employee em.getTransaction().begin(); Employee emp = service.createEmployee(158, "John Doe", 45000); em.getTransaction().commit(); System.out.println("Persisted " + emp); // find a specific employee emp = service.findEmployee(158); System.out.println("Found " + emp); // find all employees // List<Employee> emps = service.findAllEmployees(); // for (Employee e : emps) // System.out.println("Found employee: " + e); // update the employee em.getTransaction().begin(); emp = service.raiseEmployeeSalary(158, 1000); em.getTransaction().commit(); System.out.println("Updated " + emp); // remove an employee em.getTransaction().begin(); service.removeEmployee(158); em.getTransaction().commit(); System.out.println("Removed Employee 158"); // close the EM and EMF when done em.close(); emf.close(); } } Finally my confs. pom.xml: <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>Test_JPA_CRUD</groupId> <artifactId>Test_JPA_CRUD</artifactId> <packaging>jar</packaging> <version>1.0</version> <name>Test_JPA_CRUD</name> <url>http://maven.apache.org</url> <repositories> <repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/ </url> <layout>default</layout> </repository> <repository> <id>maven.org</id> <name>maven.org Repository</name> <url>http://repo1.maven.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> <!-- <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> </dependency> --> <!-- <dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> <version>1.0</version> </dependency> --> <!-- JPA2 provider --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.4.0.GA</version> </dependency> <!-- JDBC driver --> <dependency> <groupId>org.apache.derby</groupId> <artifactId>derby</artifactId> <version>10.5.3.0_1</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>ejb3-persistence</artifactId> <version>3.3.2.Beta1</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.5.2</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> </dependencies> <build> <plugins> <!-- compile with mvn assembly:assembly --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.2</version> </plugin> <!-- compile with mvn assembly:assembly --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.2-beta-2</version> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>sas.test.main.ExecuteMe</mainClass> </manifest> </archive> </configuration> <executions> <execution> <phase>package</phase> </execution> </executions> </plugin> <plugin> <!-- Force UTF-8 & Java-Version 1.6 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <!--<encoding>utf-8</encoding>--> </configuration> </plugin> </plugins> </build> </project> and the persistence.xml, which, I promise, is in the classpath of the target: <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence "> <persistence-unit name="EmployeeService" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>sas.test.model.Employee</class> <properties> <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/> <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/> <property name="hibernate.show_sql" value="true"/> <property name="javax.persistence.jdbc.url" value="jdbc:derby:webdb;create=true"/> </properties> </persistence-unit> </persistence> As you may have noticed from some commented code, I tried both, the Hibernate and the J2EE 6 implementation of JPA2.0, however, both failed. The above-mentioned code ends up with following error: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.UnsupportedOperationException: The user must supply a JDBC connection at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:54) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142) Any idea what's going wrong? Any "Hello World" maven/JPA2 demo that actually runs? I couldn't get any of those provided by google's search running. Thanx in advance.

    Read the article

  • JPQL: unknown state or association field (EclipseLink)

    - by Kawu
    I have an Employee entity which inherits from Person and OrganizationalUnit: OrganizationalUnit: @MappedSuperclass public abstract class OrganizationalUnit implements Serializable { @Id private Long id; @Basic( optional = false ) private String name; public Long getId() { return this.id; } public void setId( Long id ) { this.id = id; } public String getName() { return this.name; } public void setName( String name ) { this.name = name; } // ... } Person: @MappedSuperclass public abstract class Person extends OrganizationalUnit { private String lastName; private String firstName; public String getLastName() { return this.lastName; } public void setLastName( String lastName ) { this.lastName = lastName; } public String getFirstName() { return this.firstName; } public void setFirstName( String firstName ) { this.firstName = firstName; } /** * Returns names of the form "John Doe". */ @Override public String getName() { return this.firstName + " " + this.lastName; } @Override public void setName( String name ) { throw new UnsupportedOperationException( "Name cannot be set explicitly!" ); } /** * Returns names of the form "Doe, John". */ public String getFormalName() { return this.lastName + ", " + this.firstName; } // ... } Employee entity: @Entity @Table( name = "EMPLOYEES" ) @AttributeOverrides ( { @AttributeOverride( name = "id", column = @Column( name = "EMPLOYEE_ID" ) ), @AttributeOverride( name = "name", column = @Column( name = "LASTNAME", insertable = false, updatable = false ) ), @AttributeOverride( name = "firstName", column = @Column( name = "FIRSTNAME" ) ), @AttributeOverride( name = "lastName", column = @Column( name = "LASTNAME" ) ), } ) @NamedQueries ( { @NamedQuery( name = "Employee.FIND_BY_FORMAL_NAME", query = "SELECT emp " + "FROM Employee emp " + "WHERE emp.formalName = :formalName" ) } ) public class Employee extends Person { @Column( name = "EMPLOYEE_NO" ) private String nbr; // lots of other stuff... } I then attempted to find an employee by its formal name, e.g. "Doe, John" using the query above: SELECT emp FROM Employee emp WHERE emp.formalName = :formalName However, this gives me an exception on deploying to EclipseLink: Exception while preparing the app : Exception [EclipseLink-8030] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.JPQLException Exception Description: Error compiling the query [Employee.FIND_BY_CLIENT_AND_FORMAL_NAME: SELECT emp FROM Employee emp JOIN FETCH emp.client JOIN FETCH emp.unit WHERE emp.client.id = :clientId AND emp.formalName = :formalName], line 1, column 115: unknown state or association field [formalName] of class [de.bnext.core.common.entity.Employee]. Local Exception Stack: Exception [EclipseLink-8030] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.JPQLException Exception Description: Error compiling the query [Employee.FIND_BY_CLIENT_AND_FORMAL_NAME: SELECT emp FROM Employee emp JOIN FETCH emp.client JOIN FETCH emp.unit WHERE emp.client.id = :clientId AND emp.formalName = :formalName], line 1, column 115: unknown state or association field [formalName] of class [de.bnext.core.common.entity.Employee]. Qs: What's wrong? Is it prohibited to use "artificial" properties in JPQL, here the WHERE clause? What are the premises here? I checked the capitalization and spelling many times, I'm out of luck.

    Read the article

  • Losing a programmer, what steps to take?

    - by Zak
    One of the programmers on our team is leaving for greener pastures. We will be going from 6 to 5. What steps should we take to ensure our development process continues to run smoothly, potentially while integrating in new blood. We are currently working on a short release cycle with iterative development. Design - code - review. The person leaving was the most senior dev on the team, and would often give lots of feedback to the rest of the team, especially during the design phase.

    Read the article

  • Single entity with single view or two views in mvc3 vs2010?

    - by user2905798
    I have the following entity model public class Employee { public int Employee ID{get;set;} public string employeename{get;set;} public datetime employeeDOb{get;set;} public datetime? employeeDateOfJoin{get;set;} public string empFamilyname{get;set;} public datetime empFamilyDob{get;set;} } here I have to design a view for collecting employee information and employee family information. Since I am working on already available data, where in empFamilyDob was not mandatory. But now it is being made mandatory, the previous data doesn't contain EmpFamilyDob. So naturally I have added this new property EmpFamilyDob to the Model and made it required through DataAnnotations. Now there are two set of views to be developed. 1. A view which simply allows to collect the employee information without employee family information. i.e, empFamilyName and EmpFamilyDob.--This view is used by the Hr section to insert empplyee details Since the empFamilyname and EmpFamilyDob being now made mandatory, some other section will edit the data and update the EmpFamilyName and EmpFamilyDob as and when the information about employee family details are received. I have action controller for CreateNew and Edit Which is being generated by using the default model. There are two user actions being performed. 1.When the user clicks the Create new -- he will be able to update only the Employee information 2.As and when the other section receives the employee family details they update the familyname and family date of birth. i.e, EmployeeFamilyname and EmployeFamilyDob. While creating new record the uses should be able to update employee information only and while editing the information he should be able to update the employeefamily information. Since I have a single view with most of these fields as required and not allowing null , How can I achieve this in a sincle view? I have recorrected the model like this public class Employee { public int Employee ID{get;set;} public string employeename{get;set;} public datetime employeeDOb{get;set;} public datetime? employeeDateOfJoin{get;set;} public string empFamilyname{get;set;} public datetime? empFamilyDob{get;set;} } Now by default I hope the createnew action would insert null value for empFamilyname(string datatype) and empFamilyDob . In the Edit action the user should be made to enter empFamilyname and empFamilyDob(mandatory). As there is every chance that the user might edit other information about the employee(like employeeDob) I don't want to go for partial views. Can you help me out with some illustration. Thanks in advance

    Read the article

  • If I define a property to prototype appears in the constructor of object, why?

    - by Eduard Florinescu
    I took the example from this question modified a bit: What is the point of the prototype method? function employee(name,jobtitle,born) { this.name=name; this.jobtitle=jobtitle; this.born=born; this.status="single" } employee.prototype.salary=10000000; var fred=new employee("Fred Flintstone","Caveman",1970); console.log(fred.salary); fred.salary=20000; console.log(fred.salary) And the output in console is this: What is the difference salary is in constructor but I still can access it with fred.salary, how can I see if is in constructor from code, status is still employee property how can I tell for example if name is the one of employee or has been touch by initialization? Why is salary in constructor, when name,jobtitle,born where "touched" by employee("Fred Flintstone","Caveman",1970); «constructor»?

    Read the article

  • How to suggest changes as a recently-hired employee ?

    - by ereOn
    Hi, I was recently hired in a big company (thousands of people, to give an idea of the size). They said they hired me because of my rigor and because I was, despite my youngness (i'm 25), experienced as a C/C++ programer. Now that I'm in, I can see that the whole system is old and often uses obsolete technologies. There is no naming convention (files, functions, variables, ...), they don't use Version Control, don't use exceptions or polymorphism and it seems like almost everybody lost his passion (some of them are only 30 years old). I'd like to suggest somes changes but i don't want to be "the new guy that wants to change everything just because he doesn't want to fit in". I tried to "fit in", but actually, It takes me one week to do what I would do in one afternoon, just because of the poor tools we're forced to use. A lot my collegues never look at the new "things" and techniques that people use nowadays. It's like they just given up. The situation is really frustrating. Have you ever been in a similar situation and, if so, what advices would you give me ? Is there a subtle way of changing things without becoming the black sheep here ? Or should I just give up my passion and energy as well ? Thank you. Updates Just in case (if anyone cares): following your precious advices I was able to suggest changes and am now in charge of the team that must create and deploy Subversion :D Thanks to all of you !

    Read the article

  • Should we persist with an employee still writing bad code after many years?

    - by user94986
    I've been assigned the task of managing developers for a well-established company. They have a single developer who specialises in all their C++ coding (since forever), but the quality of the work is abysmal. Code reviews and testing have revealed many problems, one of the worst being memory leaks. The developer has never tested his code for leaks, and I discovered that the applications could leak many MBs with only a minute of use. User's were reporting huge slowdowns, and his take was, "it's nothing to do with me - if they quit and restart, it's all good again." I've given him tools to detect and trace the leaks, and sat down with him for many hours to demonstrate how the tools are used, where the problems occur, and what to do to fix them. We're 6 months down the track, and I assigned him to write a new module. I reviewed it before it was integrated into our larger code base, and was dismayed to discover the same bad coding as before. The part that I find incomprehensible is that some of the coding is worse than amateurish. For example, he wanted a class (Foo) that could populate an object of another class (Bar). He decided that Foo would hold a reference to Bar, e.g.: class Foo { public: Foo(Bar& bar) : m_bar(bar) {} private: Bar& m_bar; }; But (for other reasons) he also needed a default constructor for Foo and, rather than question his initial design, he wrote this gem: Foo::Foo() : m_bar(*(new Bar)) {} So every time the default constructor is called, a Bar is leaked. To make matters worse, Foo allocates memory from the heap for 2 other objects, but he didn't write a destructor or copy constructor. So every allocation of Foo actually leaks 3 different objects, and you can imagine what happened when a Foo was copied. And - it only gets better - he repeated the same pattern on three other classes, so it isn't a one-off slip. The whole concept is wrong on so many levels. I would feel more understanding if this came from a total novice. But this guy has been doing this for many years and has had very focussed training and advice over the past few months. I realise he has been working without mentoring or peer reviews most of that time, but I'm beginning to feel he can't change. So my question is, would you persist with someone who is writing such obviously bad code?

    Read the article

  • I need to create an employee schedule/appointments program, but I don't know how to set it up

    - by robz228
    I work for a gym. I am the programmer, its just me, nobody else! Gets really frustrating when there's nobody to bounce conceptual ideas off of. I'm getting rid of our archaic paper binder systems for tracking appointments and what not. I've made a lot of things successfully already, now I'm trying to tackle the personal training department. What I want: Trainer information and work schedule Appointment booking that can be done by time slot with all available trainers for that time, or by trainer with all available hours for that trainer What I've tried so far: I started with an 'appointments' database, a 'trainers' database, and a 'schedules' database. This became so complicated trying to fit the schedule in that I scrapped it. Does anyone know know the best way to structure the tables for this and how to sort of make them communicate correctly? I don't need specific code, I just need help understand how to make this thing!

    Read the article

  • How to deal with employee that ignores my emails? [closed]

    - by Nutel
    I have started to work on a project with quite complex business logic and architecture. While I try to understand as much as possible by myself sometimes I do not get why things work in a certain way, and if after sufficient amount of time the problem stays unsolved I send an email describing what the issue is to a team-mate who works on the project for a long time. But often the email is just ignored or answered with one-two short sentences which do not explain a lot. What is the best way to deal with this situation?

    Read the article

  • WebGrid Helper and Complex Types

    - by imran_ku07
        Introduction:           WebGrid helper makes it very easy to show tabular data. It was originally designed for ASP.NET Web Pages(WebMatrix) to display, edit, page and sort tabular data but you can also use this helper in ASP.NET Web Forms and ASP.NET MVC. When using this helper, sometimes you may run into a problem if you use complex types in this helper. In this article, I will show you how you can use complex types in WebGrid helper.       Description:             Let's say you need to show the employee data and you have the following classes,   public class Employee { public string Name { get; set; } public Address Address { get; set; } public List<string> ContactNumbers { get; set; } } public class Address { public string City { get; set; } }               The Employee class contain a Name, an Address and list of ContactNumbers. You may think that you can easily show City in WebGrid using Address.City, but no. The WebGrid helper will throw an exception at runtime if any Address property is null in the Employee list. Also, you cannot directly show ContactNumbers property. The easiest way to show these properties is to add some additional properties,   public Address NotNullableAddress { get { return Address ?? new Address(); } } public string Contacts { get { return string.Join("; ",ContactNumbers); } }               Now you can easily use these properties in WebGrid. Here is the complete code of this example,  @functions{ public class Employee { public Employee(){ ContactNumbers = new List<string>(); } public string Name { get; set; } public Address Address { get; set; } public List<string> ContactNumbers { get; set; } public Address NotNullableAddress { get { return Address ?? new Address(); } } public string Contacts { get { return string.Join("; ",ContactNumbers); } } } public class Address { public string City { get; set; } } } @{ var myClasses = new List<Employee>{ new Employee { Name="A" , Address = new Address{ City="AA" }, ContactNumbers = new List<string>{"021-216452","9231425651"}}, new Employee { Name="C" , Address = new Address{ City="CC" }}, new Employee { Name="D" , ContactNumbers = new List<string>{"045-14512125","21531212121"}} }; var grid = new WebGrid(source: myClasses); } @grid.GetHtml(columns: grid.Columns( grid.Column("NotNullableAddress.City", header: "City"), grid.Column("Name"), grid.Column("Contacts")))                    Summary:           You can use WebGrid helper to show tabular data in ASP.NET MVC, ASP.NET Web Forms and  ASP.NET Web Pages. Using this helper, you can also show complex types in the grid. In this article, I showed you how you use complex types with WebGrid helper. Hopefully you will enjoy this article too.  

    Read the article

  • adding jquery validation after form created

    - by CoffeeCode
    im using a jquery validation plugin first i add the validation to the form: $('#EmployeeForm').validate({ rules: { "Employee.FirstName": "required", "Employee.PatronymicName": "required", "Employee.LastName": "required", "Employee.BirthDay": { required: true, date: true } }, messages: { "Employee.FirstName": { required: "*" }, "Employee.PatronymicName": { required: "*" }, "Employee.LastName": { required: "*" }, "Employee.BirthDay": { required: "*", date: "00.00.00 format" } } }); and then latter a need to add validation rules to other form elements: $('#Address_A.Phone1, #Address_A.Phone2, #Address_B.Phone1, #Address_B.Phone2').rules("add", { digits: true, messages: { digits: "?????? ?????" } }); but i get an error: 'form' is null or not an object i check, the form and all the elements in it are created before i add validation to it. cant figer out whats wrong.

    Read the article

  • Dependency between multiple classes

    - by CliffC
    I am confuse between the best way to organize dependency between multiple classes assume i have the following classes Employee, Salary, DataAccess Should i go for: Option1 Employee emp = new Employee(); Salary sal = new Salary(); DataAccess data = new DataAccess(); sal.Calculate(emp); data.Save(emp); or Option2 Employee emp = new Employee(); Salary sal = new Salary(); sal.Calculate(emp); //once salary has been calculated salary object will initialize data access class to do the actual saving. or Option 3 Employee emp = new Employee(); emp.Calculate(); // employee object will encapsulate both the salary and data access object

    Read the article

  • Can operator<< in derived class call another operator<< in base class in c++?

    - by ivory
    In my code, Manager is derived from Employee and each of them have an operator<< override. class Employee{ protected: int salary; int rank; public: int getSalary()const{return salary;} int getRank()const{return rank;} Employee(int s, int r):salary(s), rank(r){}; }; ostream& operator<< (ostream& out, Employee& e){ out << "Salary: " << e.getSalary() << " Rank: " << e.getRank() << endl; return out; } class Manager: public Employee{ public: Manager(int s, int r): Employee(s, r){}; }; ostream& operator<< (ostream& out, Manager& m){ out << "Manager: "; cout << (Employee)m << endl; //can not compile, how to call function of Employee? return out; } I hoped cout << (Employee)m << endl; would call ostream& operator<< (ostream& out, Employee& e), but it failed.

    Read the article

  • C# property definition

    - by Sunny
    For C# properties, I can do this: public class Employee{ public string Name { get; private set; } public Employee(string name){ Name = name; } } which means that the Name property can be set within the class Employee & can be read publicly. But, if I want to restrict the set to only within the constructors of the Employee class, I need to do: public class Employee{ public readonly string Name = String.Empty; public Employee(string name){ Name = name; } } But, for this case, I had to change the property to a field. Is there any reason this is not possible/allowed in C#: public class Employee{ public string Name { get; private readonly set; } public Employee(string name){ Name = name; } } IMO this will allow us to have properties which can be set only in the constructor & does not require us to change properties to fields... Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >