If you dream of your ex, it can mean you did not have a clean break. If you did not prepare yourself mentally, emotionally and psychologically, you may still have unresolved issues with your ex. Your inner consciousness may crave to see resolution. Your dream of your ex may be a message from your unconscious mind.
Alternatively, if you received some external stimuli that reminded you of your ex, you may dream of that person. The stimulus/ stimuli may be triggers that instigated the replay of old memories of your ex.