I have a serializable class which contains a list of a non serializable object. So I marked that list as transient and implemented readObject and writeObject in my class. But when I serialize and deserialize my object, the readObject and writeObject methods are not entered (I have proven it by using  a sout). Don't know why it is not working. 
Here is my code.
My serializable class:
public class Product implements Serializable
{
private String reference;
private String name;
private int stock;
private double defaultPrice;
private transient List<Sale> sales = new ArrayList<>();
public Product(String reference, String name, int stock, double defaultPrice) 
{
    this.reference = reference;
    this.name = name;
    this.stock = stock;
    this.defaultPrice = defaultPrice;
}
public Product() {}
public void addSale(Date from, Date to, int minQuantity, int maxQuantity, double specialPrice)
{
    sales.add(new Sale(from, to, minQuantity, maxQuantity, specialPrice));
}
/*public double findPrice(Date date, int quantity)
{
}*/
public List<Sale> getSales()
{
    return sales;
}
 void writeObject(ObjectOutputStream oos) throws IOException
{
    System.out.println("ENTRO AQUI");
    oos.defaultWriteObject();
    oos.writeInt( sales.size() );
    for(Sale sale: this.sales)
    {
       oos.writeObject( sale.getFrom());
       oos.writeObject( sale.getTo() );
       oos.writeInt( sale.getMinQuantity() );
       oos.writeInt( sale.getMaxQuantity() );
       oos.writeDouble( sale.getSpecialPrice() );
    }
}
public void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
{
    ois.defaultReadObject();
    int salesSize = ois.readInt();
    for(int i = 0; i < salesSize; ++i)
    {
        Date from = (Date) ois.readObject();
        Date to = (Date) ois.readObject();;
        int minQuantity = (int) ois.readObject();
        int maxQuantity = (int) ois.readObject();
        double specialPrice = (double) ois.readObject();
        Sale sale = new Sale(from, to, minQuantity, maxQuantity, specialPrice);
        this.sales.add(sale);
    }
}
I didn't post setters and getters because I don't think that they are relevant.
My non-serializable class:
public class Sale 
{
private Date from;
private Date to;
private int minQuantity;
private int maxQuantity;
private double specialPrice;
public Sale(Date from, Date to, int minQuantity, int maxQuantity, double specialPrice) 
{
    this.from = from;
    this.to = to;
    this.minQuantity = minQuantity;
    this.maxQuantity = maxQuantity;
    this.specialPrice = specialPrice;
}
public Sale() {
}
By the way this is my reader:
public class BusinessBinaryReader 
{
public Business read(File file) throws IOException, ClassNotFoundException
{
    try(FileInputStream fis = new FileInputStream( file );
        BufferedInputStream bis = new BufferedInputStream( fis );
        ObjectInputStream ois = new ObjectInputStream( bis )
        )
    {
        return (Business) ois.readObject();
    }
}
}
And my writer:
public class BusinessBinaryWriter 
{
public void write(File file, Business business) throws IOException
{
    try(FileOutputStream fos = new FileOutputStream( file );
        BufferedOutputStream bos = new BufferedOutputStream( fos );
        ObjectOutputStream oos = new ObjectOutputStream( bos )
        )
    {
        oos.writeObject(business);
        oos.flush();
    }
}
}
 
     
    